Fix silent failure for some Osmose error types

When I added special handling for mapillary errors the code was trying
to access translation strings nested under the error category (which
doesn't exist for all error types). This code is now moved into it's own
function so that variable hoisting doesn't run it for non-applicable
error types and prevent them from working.

- Also adds support for error type 3040 (bad tag value)
- Updated the Osmose sidebar UI title
This commit is contained in:
SilentSpike
2019-12-30 16:20:54 +00:00
parent a068cdfc59
commit 896ed762e0
6 changed files with 34 additions and 9 deletions

View File

@@ -169,6 +169,7 @@
color: #DCB000;
}
.osmose.category-3040,
.osmose.category-3161,
.osmose.category-3250 {
color: #2D9359;

View File

@@ -828,7 +828,7 @@ en:
full_screen: Toggle Full Screen
QA:
osmose:
title: Osmose
title: Osmose Issue
error_types:
0:
title: 'Building Intersection'
@@ -863,6 +863,9 @@ en:
1280-1:
title: 'Incorrect Speed Camera'
description: '{0} should be on the highway or part of an "enforcement" relation.'
3040-3040:
title: 'Unusual Tagging'
description: '{0} has a non-conventional tag value: {1}.'
3161:
title: 'Missing Parking Access'
description: 'There is no highway leading to {0}.'
@@ -880,7 +883,7 @@ en:
description: '{0} is a power tower or pole with no connected power lines.'
7040-4:
title: 'Extra Power Line Node'
description: 'Power lines only have nodes at connections and {0} is not tagged as a power line support.'
description: 'Power lines should only have nodes at supports and {0} is not tagged as a pole or tower.'
8300:
title: 'Traffic Sign Suggestion'
description: 'Traffic signs detected by Mapillary suggest there may be an unmapped {0} nearby.'

View File

@@ -34,7 +34,7 @@
}
},
"osmose": {
"items": ["0", "1040", "1050", "1070", "1150", "1280", "3161", "3250", "4080", "7040", "8300", "8360"],
"items": ["0", "1040", "1050", "1070", "1150", "1280", "3040", "3161", "3250", "4080", "7040", "8300", "8360"],
"errorTypes": {
"0-1": {
"icon": "maki-home"
@@ -78,6 +78,9 @@
"1280-1": {
"icon": "maki-attraction"
},
"3040-3040": {
"icon": "far-times-circle"
},
"3161-1": {
"icon": "maki-parking"
},

View File

@@ -1032,7 +1032,7 @@
"full_screen": "Toggle Full Screen",
"QA": {
"osmose": {
"title": "Osmose",
"title": "Osmose Issue",
"error_types": {
"0": {
"title": "Building Intersection",
@@ -1112,6 +1112,10 @@
"title": "Incorrect Speed Camera",
"description": "{0} should be on the highway or part of an \"enforcement\" relation."
},
"3040-3040": {
"title": "Unusual Tagging",
"description": "{0} has a non-conventional tag value: {1}."
},
"3250-32501": {
"title": "Invalid Opening Hours",
"description": "{0} has an invalid value for the \"opening_hours\" tag."
@@ -1122,7 +1126,7 @@
},
"7040-4": {
"title": "Extra Power Line Node",
"description": "Power lines only have nodes at connections and {0} is not tagged as a power line support."
"description": "Power lines should only have nodes at supports and {0} is not tagged as a pole or tower."
}
}
},

View File

@@ -144,13 +144,10 @@ export default {
// Special handling for some error types
// Setting elems here prevents UI error detail requests
var parts = dataEn.QA.osmose.error_types[d.item].parts;
switch (d.item) {
case 8300:
case 8360:
// todo: possible to add link to open mapillay photo overlay?
d.replacements = [parts[d.class]];
d.elems = [];
mapillaryError(d);
break;
}
@@ -167,6 +164,13 @@ export default {
_erCache.loadedTile[tile.id] = true;
});
});
function mapillaryError(d) {
// Parts only exists for these error types
var parts = dataEn.QA.osmose.error_types[d.item].parts;
d.replacements = [parts[d.class]];
d.elems = [];
}
},
loadErrorDetail: function(d, callback) {
@@ -192,6 +196,15 @@ export default {
return linkEntity(i);
});
// Special handling for some error types
switch (d.item) {
case 3040:
d.replacements.push(/Bad value for (.+)/i
.exec(data.subtitle)[1]
);
break;
}
that.replaceError(d);
if (callback) callback(null, d);
})

View File

@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="times-circle" class="svg-inline--fa fa-times-circle fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"></path></svg>

After

Width:  |  Height:  |  Size: 712 B