Fee: Double condition

I’m looking for the correct fee tag for this situation:

There is a report of a parking space where fee is only charged if two conditions are met:

  • The first 2 hours are always free.
  • After that, fee is only charged Mon-Fri 7-19h and Sat 7-13h.

I’m unsure about the correct syntax.

This is no more than a blind guess:
fee=no +
fee:conditional=yes @ (stay > 2 hours & (Mo-Fr 07:00-19:00; Sa 07:00-13:00))

Can someone help?

3 Likes

Your proposal looks perfectly fine to me, fee=no covers most of the time with fee:conditional detailing the condition for which that is not true.

This is close, but the operator for a conjunction is AND or and, not &.

2 Likes

Nice thanks! Are nested round brackets ok?

So should I use
fee=no +
fee:conditional=yes @ (stay > 2 hours AND (Mo-Fr 07:00-19:00; Sa 07:00-13:00))

or rather
fee=no +
fee:conditional=yes @ (stay > 2 hours AND Mo-Fr 07:00-19:00); yes @ (stay > 2 hours AND Sa 07:00-13:00)
?

I want as many automated data consumers as possible to be able to understand the tag.

If you use Josm, Josm will automatically verify conditional restrictions. For the first variant it gives:

Does not match pattern ‘restriction @ condition’

The second form is accepted without problems.

I am not sure the first pattern is really wrong but I would go for the second pattern.

1 Like

Thanks.

However, in my experience it doesn’t always do good to blindly trust and follow the suggestions of these validators. :slight_smile:
I strive to understand what I’m doing.

2 Likes

Note that in the 1st example the outer parentheses and in the 2nd one all of them are unnecessary.

2 Likes

The wiki uses round brackets throughout, except if the condition is a single word. @SimonPoole are you saying the round brackets can be removed from almost all examples in the wiki articles for fee and conditional restrictions (except for those containing ;)?

Yes and this needs to be a complete sentence even if ‘yes’ is a complete answer.

2 Likes

I’m marking

fee=no +
fee:conditional=yes @ stay > 2 hours AND Mo-Fr 07:00-19:00; yes @ stay > 2 hours AND Sa 07:00-13:00

as solution.

Thanks @Minh_Nguyen @emvee and @SimonPoole

1 Like

There’s a lone closing bracket. QA will protest not being able to parse.

2 Likes

Corrected and this also needs to be a complete sentence.