Skip to content

Commit

Permalink
Replace 'crossing=yes' with something better, if possible
Browse files Browse the repository at this point in the history
(closes #1284)

This also includes a change to adjust the validation message slightly,
if we are just suggesting a single tag change, consider it a
"tag upgrade" not a "tag conflict".
  • Loading branch information
bhousel committed Jan 5, 2024
1 parent d960baf commit 27e70c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion modules/actions/sync_crossing_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ export function actionSyncCrossingTags(entityID) {
const modernSignaled = (signals && signals !== 'no');
if (
(legacyMarked && !modernMarked) || (!legacyMarked && modernMarked) ||
(legacySignaled && !modernSignaled) || (!legacySignaled && modernSignaled)
(legacySignaled && !modernSignaled) || (!legacySignaled && modernSignaled) ||
(crossing === 'yes' && markings) // replace 'yes' with something better - Rapid#1284
) {
crossing = null;
delete tags.crossing;
Expand Down
25 changes: 14 additions & 11 deletions modules/validations/ambiguous_crossing_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,16 @@ export function validationAmbiguousCrossingTags(context) {
// If we haven't already, create the 'not a crossing' choice to remove the crossing tags completely.
addChoice(inferCrossingType({/* no tags */}));

// If the updates are only adding tags, this is considered an "upgrade" not a "conflict"
let isOnlyAddingTags = true;
for (const update of updates.values()) {
if (!update.tagDiff?.length) continue;
if (update.tagDiff.some(d => d.type === '-')) {
isOnlyAddingTags = false;
break;
// If a single update, or multiple updates only adding tags, this is considered an "upgrade"..
// If multiple updates with tag changes, this is consideredd a "conflict"..
let isTagUpgrade = true;
if (updates.size > 1) {
for (const update of updates.values()) {
if (!update.tagDiff?.length) continue;
if (update.tagDiff.some(d => d.type === '-')) {
isTagUpgrade = false;
break;
}
}
}

Expand All @@ -134,7 +137,7 @@ export function validationAmbiguousCrossingTags(context) {
data: {
isParentCrossing: isParentCrossing,
isParentChanged: isParentChanged,
isOnlyAddingTags: isOnlyAddingTags,
isTagUpgrade: isTagUpgrade,
updates: updates,
choices: choices
},
Expand Down Expand Up @@ -210,7 +213,7 @@ export function validationAmbiguousCrossingTags(context) {
const issue = this;
const wayID = issue.entityIds[0];
const choices = issue.data.choices;
const stringID = issue.data.isOnlyAddingTags ? 'update_type' : 'choose_type';
const stringID = issue.data.isTagUpgrade ? 'update_type' : 'choose_type';
const fixes = [];

for (const [type, choice] of choices) {
Expand Down Expand Up @@ -265,9 +268,9 @@ export function validationAmbiguousCrossingTags(context) {
const issue = this;
const data = issue.data;

if (data.isParentCrossing && !data.isParentChanged && data.isOnlyAddingTags) {
if (data.isParentCrossing && !data.isParentChanged && data.isTagUpgrade) {
return l10n.t('issues.ambiguous_crossing.message.candidate');
} else if (data.isOnlyAddingTags) {
} else if (data.isTagUpgrade) {
return l10n.t('issues.ambiguous_crossing.message.update');
} else {
return l10n.t('issues.ambiguous_crossing.message.conflict');
Expand Down

0 comments on commit 27e70c0

Please sign in to comment.