Closed bismurphy closed 5 months ago
Ooh, interesting idea. Can you point this to the testing branch please? Then we can deploy it and it will show up at testing.v2.sondehub.org
Thanks! Changed to testing, let me know if this introduces any issues!
When viewing SondeHub, a user will see some number of balloons in their view. Balloons are colored with a few different colors, to make it easy to tell them apart.
Currently, the color is selected by iterating through all the balloons, one by one, and each balloon gets a color from the list of colors, sequentially. Because balloons are iterated through in a non-deterministic manner (such that inserting or removing one balloon from the set will change the outcome of the others), viewing the set of balloons multiple times will result in the colors becoming re-shuffled. Therefore, refreshing the page, or viewing it on multiple devices (including viewing the site alongside a friend) will mean the same balloon will appear with different colors on different viewings.
This PR changes the logic such that the color is chosen by a hash of the callsign for the balloon, meaning that a given balloon will always show up with the same color for all viewers on all viewings. Because the balloon_index variable is no longer used, I have removed it.