Fix: Update asc / desc reachability sorting #970
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We had a bug reported internally in Slack that our reachability Asc / Desc. were reporting the wrong way round.
Solution
This PR switches the order of Asc / Desc. As I was fixing this I noticed that undefined and other falsey values of reachability were given a value of 101 so put them above 100% (which I think is what led to this bug implementation in the first place).
I noticed as I was fixing it that the code could be much more performant and use less CPU cycles, too 😄
Before
![The checks list page with ascending reachability. The checks show 0, N/A, 0, 100, 100 for their reachability values.](https://private-user-images.githubusercontent.com/6906380/375725434-9f617d5d-39e3-4e98-95aa-d4de22869d9f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTI0ODMsIm5iZiI6MTczOTYxMjE4MywicGF0aCI6Ii82OTA2MzgwLzM3NTcyNTQzNC05ZjYxN2Q1ZC0zOWUzLTRlOTgtOTVhYS1kNGRlMjI4NjlkOWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDkzNjIzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDc4OTliMWMzZjJhYjVmNzgzODA0Zjg4OGViMDJiY2M4YTY2ODhhNTQ4ZDRhY2I5YWE1NWU4MWZjZGE2Nzk2ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.N_2LfAWh-c19Vcya82i6YWl3zQYfly7OKJTzrPwRWw4)
![The checks list page with descending reachability. The checks show 48.5, 59.8, 98.6, 100, 100 for their reachability values.](https://private-user-images.githubusercontent.com/6906380/375725676-e1cf9602-5515-46ef-aa1c-d52b76e87839.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTI0ODMsIm5iZiI6MTczOTYxMjE4MywicGF0aCI6Ii82OTA2MzgwLzM3NTcyNTY3Ni1lMWNmOTYwMi01NTE1LTQ2ZWYtYWExYy1kNTJiNzZlODc4MzkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDkzNjIzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWViMTU3ZjNhMjZjNDUwMmNiZTMxYTg2ZTQ0ZDZkZTQ1NzQ3NTQ4ZGNjOGM3Y2Y1YTA1ODQzY2VlN2JkZmE3NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.bfANYY5UtpeAo6c4lFVzrBqcm5J2Bu2OxSiyf-Q9_O8)
After