-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort building type by recently used frequency #3373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: all issues resolved. Previous contents inside.
This is fully mostly functional, but there's 3 parts that need to be addressed before it is ready for merge.
app/src/main/java/de/westnordost/streetcomplete/quests/AGroupedImageListQuestAnswerFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/quests/LastPickedValuesStore.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/quests/AGroupedImageListQuestAnswerFragment.kt
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/quests/LastPickedValuesStore.kt
Show resolved
Hide resolved
- Look farther back in history, only if needed to find enough items - Always include the most recent answer (not always at the top) - Use sequences to do the above in a more readable way - Probably also faster, not that I measured. - Move to LastPickedValuesStore and be more generic, so other quests could use the same sorting strategy.
And remove "client-side" limit for grouped quest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested manually, but I think it might be good to add some unit tests for getWeighted
before merge, since there are quite a few edge cases which would be easy to screw up by accident.
app/src/main/java/de/westnordost/streetcomplete/quests/LastPickedValuesStore.kt
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/quests/LastPickedValuesStore.kt
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/quests/LastPickedValuesStore.kt
Outdated
Show resolved
Hide resolved
Okay, nothing more I want to do here, ready for merge after review. |
app/src/main/java/de/westnordost/streetcomplete/quests/LastPickedValuesStore.kt
Outdated
Show resolved
Hide resolved
app/src/test/java/de/westnordost/streetcomplete/quests/LastPickedValuesStoreTest.kt
Outdated
Show resolved
Hide resolved
Is there limit for number of remembered solutions? It would be useful for two reasons:
So I think that storing last 100 solutions would be sufficient. |
app/src/test/java/de/westnordost/streetcomplete/quests/LastPickedValuesStoreTest.kt
Show resolved
Hide resolved
app/src/test/java/de/westnordost/streetcomplete/quests/LastPickedValuesStoreTest.kt
Outdated
Show resolved
Hide resolved
Currently 100, see #3373 (comment) and line 24 of the store.
There is a temptation to obsess over performance here, because it is a problem with lots of opportunities to optimize.
Okay, but what if…
We'd need to read that whole string into memory, so we'd need around 100KB of free RAM. This also seems pretty minimal. Sequences are lazily evaluated, and If we actually used all 10k values, then we might want to switch to a more efficient counting implementation, like Kotlin does for Plus, this is a situation where it's easy to swap out the implementation for something more efficient if needed. So, really, this not something we have to worry about unless we profile and find a problem. |
I'm heading out for a few hours, will make the mentioned changes when I return. |
Nothing to add, looks very good. |
In general, would it make sense to apply this sort order to all quests that have their sort order re-shuffled to have recently selected items first? |
I'm not sure. I think it may be different quest-by-quest, so I'd like to at least do some spot-checks. In any case, I'll go send the follow-up clean-up PR now :) |
Consistency is key |
I have thought most about applying this order to the building levels quest. For it:
|
Yeah let's use it for the which but then sort it by how it is currently sorted. |
One thing I noticed while testing with the current implementation is that the history is not changed when you undo an answer. In testing, it's easy to rack up a bunch of answers in your history by doing and un-doing one quest. Not going to worry about it unless it turns out to be a problem. If you want to include this in the changelog, I suggest something like:
or
|
I'm not sure if this is the right place to comment on this, but I didn't want to open an issue for it. I like the idea of this change, but in practice I will admit it was confusing (coming from the expectations and experience with the old configuration, especially). Yesterday, I went to an area with a lot of different building types (many industrial and shops). When I got to an area with just rowhouses (by far the most common type around here) I had to reselect it from the full menu (not a problem), but then on the second building, the recent selection of =terrace was not in the top three (which is all I can see on my phone without scrolling) and kept changing places as I kept mapping. If the last selection was always at the top, then when you keep selecting the same type, it's always in the same spot (whereas otherwise it might change places as it gets more "popular"). When I'm mapping terraces, there's always going to be a bunch in a row. So essentially, my preference would be latest in spot # 1 always, then # 2-6 sorted by popularity. Thus if there are a lot of the same type (even if it's a new type), you'll find it at the top, but if you select one of # 2-6, the previous # 1 drops to its spot in recent popularity. |
A new discussion would be ideal. |
Fixes #1771