Closed AstralShadow closed 1 year ago
Ahh I see, this will insert new entries earlier so as to highlight the latest one when two scores match. Have you checked that this works? I'm concerned that scores.sort call right after might mess with the order (though I haven't tested it myself).
Sadly, the dart List.sort says:
The sort function is not guaranteed to be stable, so distinct objects that compare as equal may occur in any order in the result.
Can we assume that highscores are stored after being sorted in current version? If we do assume this, we can just insert the new highscore at it's correct position with the insert call, and we would not need to sort at all.
I implemented what i mean, but i dont have flutter configured, so could you do a compile-test and tell me if i messed up something?
Of course, though I'm busy with finals for two or so weeks at the moment. If I find a time before then I will be sure to test it!
Of course, though I'm busy with finals for two or so weeks at the moment. If I find a time before then I will be sure to test it!
Good luck on your finals!
How do you know if a
or b
is the new time?
Sort() is not sure to be stable, even if it seems to be when testing, so we can't be sure which of the two elements is the one we add.
My initial idea was that if we always keep the scoreboard sorted and we insert new scores at their proper position, it will stay sorted and not need any extra sorting.
Hmm, I think you're right. I had assumed the comparisons would happen in order of the list, but I can't find anywhere this is guaranteed. So even if it works now, it might not in future versions of Flutter. I will change it to your implementation, as it works well in this case. I'll commit the fix directly to master. Sorry about merging it so fast! To be honest, I have never handled proper pull requests before.
Can you do a version bump & release (so F-Droid shows up an update) when you got the time? Last version is from Oct 27, 2022.
Thanks for the reminder! I meant to wait to ship the tutorial "onboarding" screen with the next release, but that took much longer than expected and I've not had time to work on it due to university, so I will just release the bugfixes that we have now.
Thanks for the release! For some reason it doesn't show up as latest release. (a cause might be it being a draft, beta, or the project using manual latest release selection) As far as i know F-Droid picks the release marked as latest, so could you try to mark it as such?
Done! Marked it as the latest release, hopefully that does it.
Also applying the fix from #11 to the generated scoreboard after a game is won. (Turns out there are 2 places where the leaderboard is being edited: once when saving, and once before displaying after a winning game.)
If there is a need i can post these as 2 separate pull requests.