Skip to content
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

stile resurvey, fixes #3187 #3370

Merged

Conversation

matkoniecz
Copy link
Member

resurvey stiles, fixes #3187

resurvey happens after 8 years, so only small pool of old stiles with stile=* becomes qualified
stiles without stile=* tag would get this quest anyway
note that in rare cases, where stile type is unchanged and material tag is added - then not strictly necessary stile:check_date will be added

when changing style type also step count should be removed
resurvey happens after 8 years, so only small pool of old stiles with stile=* becomes qualified
    stiles without stile=* tag would get this quest anyway
note that in rare cases, where stile type is unchanged and material tag is added - then not strictly necessary stile:check_date will be added
@matkoniecz matkoniecz changed the title No longer failed stile resurvey No longer failed stile resurvey, fixes #3187 Oct 11, 2021
@matkoniecz matkoniecz changed the title No longer failed stile resurvey, fixes #3187 stile resurvey, fixes #3187 Oct 11, 2021
@matkoniecz matkoniecz force-pushed the no_longer_failed_stile_resurvey branch from 14c2292 to 6965331 Compare October 11, 2021 19:06
in this case maybe deleting all of them would be a good idea, but it has history of being changes to whitelist anyway
@matkoniecz matkoniecz added the hacktoberfest-accepted pull request that should be treated as eligible for Hacktoberfest event label Oct 11, 2021
Copy link
Collaborator

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, a few possible resurvey improvements.

This is however going to make #2754 harder again unfortunately. I suspect the ideal would be a generic update function which takes a list of tags to deleteIfExist if the main tag's value has changed, but I can do that in my PR if you'd rather.

@matkoniecz matkoniecz marked this pull request as draft October 12, 2021 14:38
@matkoniecz
Copy link
Member Author

Spotted one problem - on marking stepover stile where material was marked already it is not OK to (1) delete it in general function (2) later add it

It results in:

java.lang.IllegalStateException: The key 'material' is already being modified.

in case where wooden stepover stile is replaced by stone stepover tile (or in reverse) - delete tags such as step count
extracts complex repeated part, so applyAnswerTo can be comprehended
@matkoniecz
Copy link
Member Author

matkoniecz commented Oct 12, 2021

For now missing material is not triggering resurvey and I am still not really convinced that it should happen.

(BTW, I am curious how many people are actually using SC in areas with stiles anyway - and is time saved by implementing this quests greater than total time used to implement. research and discuss them :) )

@matkoniecz matkoniecz marked this pull request as ready for review October 12, 2021 15:26
Copy link
Collaborator

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More minor suggestions

Comment on lines 56 to 58
private fun StringMapChangesBuilder.deleteIfExistList(keys: List<String>) {
keys.forEach { deleteIfExists(it) }
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not go in app/src/main/java/de/westnordost/streetcompletedata/osm/edits/update_tags/StringMapChangesBuilder.kt so it can be reused elsewhere?

Can we override like in C++ so they're both called deleteIfExists and you can pass in a List or a String?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matkoniecz
please either put this function into app/src/main/java/de/westnordost/streetcompletedata/osm/edits/update_tags/StringMapChangesXt.kt or at the end of this file outside the class definition (your choice).

Can we override like in C++ so they're both called deleteIfExists and you can pass in a List or a String?

Yes, no problem. The naming of the function is all the same to me though.

@peternewman
Copy link
Collaborator

For now missing material is not triggering resurvey and I am still not really convinced that it should happen.

As in you don't think it's worth asking earlier for the material than during a traditional resurvey?

(BTW, I am curious how many people are actually using SC in areas with stiles anyway - and is time saved by implementing this quests greater than total time used to implement. research and discuss them :) )

I try and use SC whenever I go out walking (and wherever I walk). I very rarely bother with iD or other local editing in front of my PC (or anything else aside from SC). I've also just finished walking coast to coast across the UK (via Hadrian's Wall) although it seems I've only answered five stile quests so far (partly as some weren't tagged, hence #3372 ) and partly not enough data loaded (it's a very long way). However that's more than the number of CCTV quests I've done, which have been around for similar lengths of time and I spend far more time in the city...

Aside from the relative value of different types of quests/their data, then generally I'll go places with stiles less frequently, and the same place less so, than say commuting around parts of the city, so gathering that data then is more valuable than somewhere I pass daily for work and so could build up over a number of days.

The secret truth I probably don't want to tell myself is that for me personally I only really use OSM for car sat nav currently, so the connected graph of streets, road and house names/numbers and maybe speed limit and road surface is all I directly use... Although I'm seeing more websites switch to it recently.

@westnordost
Copy link
Member

I haven't been following the conversation. @matkoniecz , please mark if this ready to review/merge by requesting a review when everything that you think should be resolved is resolved.

@matkoniecz
Copy link
Member Author

Given that material is not really used anywhere despite being tagged quite frequently - I think that I will keep it as is.

Copy link
Member

@westnordost westnordost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the added complexity in applyAnswerTo, I strongly suggest to write test cases to cover the different code paths here but I'll leave this up to you. In the end, this is your quest type.

It might be possible to reduce the complexity by following @peternewman 's advice.

Comment on lines 56 to 58
private fun StringMapChangesBuilder.deleteIfExistList(keys: List<String>) {
keys.forEach { deleteIfExists(it) }
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matkoniecz
please either put this function into app/src/main/java/de/westnordost/streetcompletedata/osm/edits/update_tags/StringMapChangesXt.kt or at the end of this file outside the class definition (your choice).

Can we override like in C++ so they're both called deleteIfExists and you can pass in a List or a String?

Yes, no problem. The naming of the function is all the same to me though.

matkoniecz and others added 4 commits October 14, 2021 13:32
Co-authored-by: Tobias Zwick <[email protected]>
It would crash completely without barrier tag
It would not tag barrier=stile if it wold be unset and stile would be selected

Co-authored-by: Tobias Zwick <[email protected]>
confirm that toMutableList is avoidable
Comment on lines +20 to +23
fun deleteIfExistList(keys: List<String>) {
keys.forEach { deleteIfExists(it) }
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I wrote in my earlier review, I'd prefer if you added this function to StringMapChangesXt.kt, i.e. as an extension function.

Copy link
Collaborator

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your function probably still needs a little more improvement and that these test cases should be added either way.

@matkoniecz matkoniecz force-pushed the no_longer_failed_stile_resurvey branch from 3f0e575 to 281cca9 Compare October 14, 2021 17:44
@matkoniecz
Copy link
Member Author

@peternewman Thanks for noticing the problem!

@westnordost
Copy link
Member

ok so err... should I review this again?

@matkoniecz
Copy link
Member Author

There were no significant architectural changes, though a serious bug was fixed. Oh, and tests were added.

And I still need to handle #3370 (review)

@westnordost
Copy link
Member

westnordost commented Oct 15, 2021

Don't mind that, I will do this after merging.

@westnordost westnordost merged commit ea420dc into streetcomplete:master Oct 15, 2021
@westnordost
Copy link
Member

Hm, after merge I found some more deficiencies and one bug. I'll create a PR.

@peternewman
Copy link
Collaborator

Given that material is not really used anywhere despite being tagged quite frequently - I think that I will keep it as is.

Vespucci uses it for stile related presets, although maybe just to tag them, I don't know if it displays the info too:
https://taginfo.openstreetmap.org/projects/vespucci#tags

@peternewman
Copy link
Collaborator

@peternewman Thanks for noticing the problem!

Well done for spotting the far bigger bug I missed with the wrong key!

@peternewman peternewman mentioned this pull request Oct 15, 2021
@matkoniecz matkoniecz deleted the no_longer_failed_stile_resurvey branch October 15, 2021 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted pull request that should be treated as eligible for Hacktoberfest event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resurveying of stiles
6 participants