Skip to content

Commit

Permalink
show warning on selecting slow zone but specifying non-slow speed (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Apr 28, 2024
1 parent aae003b commit 315a68f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,13 @@ class AddMaxSpeedForm : AbstractOsmQuestForm<MaxSpeedAnswer>() {

private fun userSelectedUnusualSpeed(): Boolean {
val speed = getSpeedFromInput() ?: return false
val isDividableByFive = speed.toValue() % 5 == 0
val kmh = speed.toKmh()
return kmh > 140 || kmh > 20 && speed.toValue() % 5 != 0 || kmh < 10
return when (speedType) {
SIGN -> kmh > 140 || kmh > 20 && !isDividableByFive || kmh < 5
ZONE -> kmh > 40 || kmh > 20 && !isDividableByFive || kmh < 5
else -> false
}
}

private fun switchToAdvisorySpeedLimit() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ If any lanes are reserved for buses, please leave a note instead."</string>
<string name="quest_maxspeed_title_short2">"What’s the speed limit for this street?"</string>
<string name="quest_maxspeed_sign_question">What defines the speed limit?</string>
<string name="quest_maxspeed_answer_sign">"A sign"</string>
<string name="quest_maxspeed_answer_zone2">"It’s within a (slow) zone"</string>
<string name="quest_maxspeed_answer_zone2">"It’s within a signed (slow) zone"</string>
<string name="quest_maxspeed_answer_living_street">It is a living street</string>
<string name="quest_maxspeed_answer_living_street_confirmation_title">So, there is a sign like this?</string>
<string name="quest_maxspeed_answer_noSign2">"No sign, defaults apply"</string>
Expand Down

0 comments on commit 315a68f

Please sign in to comment.