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

Add support new scheme tagging #83

Merged
merged 4 commits into from
Mar 17, 2022
Merged

Add support new scheme tagging #83

merged 4 commits into from
Mar 17, 2022

Conversation

zlant
Copy link
Owner

@zlant zlant commented Feb 12, 2022

Start impelementation support conditional parking tags

@zlant zlant linked an issue Feb 12, 2022 that may be closed by this pull request
@tordans
Copy link
Collaborator

tordans commented Feb 15, 2022

Thanks a lot, this looks great. Will test it out later this week.

@zlant zlant force-pushed the feature/conditional-tags branch 3 times, most recently from 164effb to 5adcfed Compare March 8, 2022 10:54
@jakecoppinger
Copy link
Contributor

Testing this out locally - the maxstay attribute is hidden when editing a section of road that already has parking data, but is visible when editing a road without data.

It correctly displays if I toggle the condition field from free to blank and back again.

I can't tell if it's a new or old bug, I assume it's caused by https://github.com/zlant/parking-lanes/pull/83/files#diff-3f0503e42c14ce29b4c2ed15add2dfb48b79118f309b6f96aed25b88d52e283eR332

Should I create a separate ticket for that?

@zlant
Copy link
Owner Author

zlant commented Mar 12, 2022

I can't tell if it's a new or old bug

It old bug, fot not this PR

'no_parking',
'no_standing',
'no_stopping',
'no',
]
Copy link
Contributor

@jakecoppinger jakecoppinger Mar 13, 2022

Choose a reason for hiding this comment

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

Should free; residents be added?

In Australia, a common scenario is:

  • Free parking
  • Time limited for public to a few hours
  • Unlimited time for residents (permit holders).

I believe this is covered by the tagging guidelines like so:

parking:condition:right=ticket; residents (This is a paid parking with no other restrictions. Residents may also park here with a permit.)
parking:condition:right:conditional=no_parking @ (Oct 1-Apr 30: Mo 10:00-15:00) (You may not park here on Mondays 10-15 during October-April.)
parking:condition:right:residents=Ku (Residents need permit "Ta".)

(Taken from second example on https://wiki.openstreetmap.org/wiki/Key:parking:condition/complex)

Copy link
Owner Author

Choose a reason for hiding this comment

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

It too future task

@@ -89,6 +90,7 @@ const parkingLaneTagTemplates = [
'parking:lane:{side}',
'parking:lane:{side}:{type}',
'parking:condition:{side}',
'parking:condition:{side}:conditional',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also include maxstay:conditional for when stay duration is limited only during the day for example

Also, should parking:condition:{side}:time_interval or parking:condition:{side}:default' be displayed any more? Or should they still be displayed in case there is legacy data?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Or should they still be displayed in case there is legacy data?parking:condition:{side}:time_interval``parking:condition:{side}:default'

yes

Copy link
Owner Author

Choose a reason for hiding this comment

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

Should this also include maxstay:conditional for when stay duration is limited only during the day for example

Will need to be added in the future

@@ -0,0 +1,56 @@
export function parseConditionalTag(tag: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like some fairly complex logic which I don't follow without some study. Could we add unit tests to the project and some basic tests for this?

I'd recommend Jest, I'm very happy to create a PR with a basic Jest configuration and example test.

Copy link
Owner Author

Choose a reason for hiding this comment

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

It will be wonderful

Copy link
Contributor

Choose a reason for hiding this comment

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

Added in PR #97. Please merge that then rebase this branch on master so we can add tests for this code.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ready

@zlant zlant force-pushed the feature/conditional-tags branch 4 times, most recently from ca0bbb4 to a9f3b43 Compare March 13, 2022 21:06
@zlant zlant force-pushed the feature/conditional-tags branch from a9f3b43 to 33d1e94 Compare March 14, 2022 11:03

conditions.conditionalValues = parseConditionsByNewScheme(side, tags)
if (conditions.conditionalValues.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand this correctly, it's attempting to parse by the new schema, then if no relevent tags are found it parses by the old schema.

Rather than trying the old than new schema, could we write a function to convert all old schema tags to new ones (and unit test this heavily to ensure it is correct), then parse by the new schema?

This would also close #93. I added a proposal for this method here: #93 (comment)

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think there should be a separate independent method that checks for old tags and suggests migration

Copy link
Owner Author

Choose a reason for hiding this comment

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

Which is called during the opening of the edit panel

Copy link
Contributor

Choose a reason for hiding this comment

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

Why suggest migration rather than do it automatically?

  • If the user declines the migration we need to parse by the old schema, and support editing using the old schema
  • Why should we encourage users to edit to an old schema?

What if we displayed a little banner or "toast" message if the tags are (automatically) migrated? (and the save button would be highlighted too).

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's out of scope in this PR I'm happy to draft a PR for what I'm thinking afterwards :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

Now many parking lots are mapped according to the old scheme and they will not be migrated manually soon.
If the user wants to make minor edits, rather than deal with the new scheme, he should leave this option.

@@ -1,6 +1,9 @@
import OpeningHours from 'opening_hours'

export function parseOpeningHourse(value: string): OpeningHours | 'even' | 'odd' | null {
export function parseOpeningHourse(value: string | null): OpeningHours | 'even' | 'odd' | null {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor typo

@zlant zlant force-pushed the feature/conditional-tags branch from 47b9a6b to d7de1b0 Compare March 17, 2022 06:42
@zlant zlant merged commit 6b381a8 into master Mar 17, 2022
@zlant zlant deleted the feature/conditional-tags branch March 17, 2022 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal for conditional parking in the wiki
3 participants