-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
handle operator as name for postboxes #1474
Conversation
also, allow each quest to give its own list of name giving tags fixes streetcomplete#1473
I looked though other quests, currently there is nothing else that would benefit from a similar change. |
That is a good solution to the problem. However, I want to propose a slightly different one and pitch it to discussion. Not sure myself if it is superior: What about if the override fun getTitle(tags: Map<String, String>) =
R.string.bla_title // "Does the road %s really have %d lanes?"
override fun getTitleReplacements(tags: Map<String, String>) =
arrayOf(tags["name"] ?: tags["ref"], tags["lanes"]) The advantage is that it is more powerful (as shown - more replacements possible, also non-name-related replacements possible) and that the control over what title is shown is exactly where it should be - in the hands of the quest itself. The default behavior (use name, otherwise brand, otherwise,...) would be defined in the The downside is, that the example above does not include a solution how to fall back to the feature name. On the other hand, the fallback is only appropriate in 1 quest. (Maybe pass a future containing the feature name into the function?) Also, it is the question if this amount of control is actually necessary because for the popular case of...
... it can not be used, because the article (and more?) will differ in other languages than English if the word has a different grammatical gender. |
I really like this solution and I plan to implement it. But I admit that it is primarily because it would allow me to resurrect "show objects with So basically for
reason. |
I'm not sure if you are already planning this, but I think that using brand would be better than operator.
|
|
How so? |
query would find all with EDIT: Though method in the current PR would also work, just pass |
Wouldn't make including the fixme text into the question bubble not make it (potentially) very very long? (But anyway, this is something for Zazolc only anyway so +shrug+) |
Maybe, but most are short - and anyway primary use is "hey, it is useful to open Vespucci here". |
I started implementing this, but my first though was - is there any reason to split it in a two functions at this point? Maybe allowing to simply return an arbitrary string would be better in case of going for a powerful and flexible title generation. |
The reason is that the quest should not have a dependency on |
I got stuck on this one, https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-future/index.html is not too informative and searching for I will look at it again, but in case that someone can recommend some resources (maybe I missed something that would be useful) - I would be happy to get recommendations. I now want to get back to checking why regression fixing PR is actually not fixing anything. |
Actually, more specifically I meant to propose to use a Lazy, sorry for that: A wrapper around a result that only computes its result once when it is actually queried. FYI: override fun getTitleReplacements(tags: Map<String, String>, featureName: Lazy<String>) =
arrayOf(tags["name"] ?: tags["brand"] ?: featureName.get())
//...
getTitleReplacements(someTags, lazy { /* query the feature dictionary for the name here */ } ) The reason why one would not simply pass the featureName directly as a String is that this would mean that every time, the feature dictionary is queried for the feature name even if the String is not actually used. |
also, allow each quest to define its own title replacement(s) (for now only the first one will be used, as there is no quest at this moment that needs to use multiple ones) fixes streetcomplete#1473, closes streetcomplete#1474
also, allow each quest to give its own list of name giving tags
fixes #1473
I also thought about adding this data to rather to OsmElementQuestType but it would require type checking on use, as getQuestTitle has parameter of
QuestType<*>
type.I tested that it works on name quest for school with
operator
tag (no displayed), post box withoperator
tag (displayed), post box, without operator tag, note quest, one way quest, road name quest.My work on this pull request and UX testing was sponsored by a NGI Zero Discovery grant