Add details to error messages

This commit is contained in:
SilentSpike
2019-01-20 15:15:45 +00:00
parent 23a4d71410
commit ca290b5101
4 changed files with 53 additions and 9 deletions
+8 -4
View File
@@ -663,16 +663,20 @@ en:
QA:
improveOSM:
title: ImproveOSM Error
error_parts:
path: path
parking_area: parking area
road: road
error_types:
ow:
title: Missing One-way
description: Aggregate data suggests {var1} may be missing a "oneway" tag. Please confirm via imagery or survey before mapping.
description: 'Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel in the same direction. There may be missing a "oneway" tag.'
mr:
title: Missing Road
description: Aggregate data suggests there may be an unmapped road here. Please confirm via imagery or survey before mapping.
title: Missing Geometry
description: Aggregate data suggests there may be an unmapped {var1} here.
tr:
title: Missing Turn Restriction
description: Aggregate data suggests this junction may be missing a turn restriction. Please confirm via imagery or survey before mapping.
description: '{num_passed} of {num_trips} recorded trips make a turn from {from_way} to {to_way}. There may be a missing "{turn_restriction}" restriction.'
keepRight:
title: KeepRight Error
detail_title: Error
+9 -4
View File
@@ -805,18 +805,23 @@
"QA": {
"improveOSM": {
"title": "ImproveOSM Error",
"error_parts": {
"path": "path",
"parking_area": "parking area",
"road": "road"
},
"error_types": {
"ow": {
"title": "Missing One-way",
"description": "Aggregate data suggests {var1} may be missing a \"oneway\" tag. Please confirm via imagery or survey before mapping."
"description": "Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel in the same direction. There may be missing a \"oneway\" tag."
},
"mr": {
"title": "Missing Road",
"description": "Aggregate data suggests there may be an unmapped road here. Please confirm via imagery or survey before mapping."
"title": "Missing Geometry",
"description": "Aggregate data suggests there may be an unmapped {var1} here."
},
"tr": {
"title": "Missing Turn Restriction",
"description": "Aggregate data suggests this junction may be missing a turn restriction. Please confirm via imagery or survey before mapping."
"description": "{num_passed} of {num_trips} recorded trips make a turn from {from_way} to {to_way}. There may be a missing \"{turn_restriction}\" restriction."
}
}
},
+35
View File
@@ -71,6 +71,14 @@ function updateRtree(item, replace) {
}
}
function linkErrorObject(d) {
return '<a class="kr_error_object_link">' + d + '</a>';
}
function linkEntity(d) {
return '<a class="kr_error_entity_link">' + d + '</a>';
}
export default {
init: function() {
if (!_erCache) {
@@ -144,15 +152,25 @@ export default {
// Road segments at high zoom == oneways
if (data.roadSegments) {
data.roadSegments.forEach(function(feature) {
// todo: make this take midpoint?
var loc = feature.points[0];
var d = new impOsmError({
loc: [loc.lon, loc.lat],
comments: null,
error_type: k,
object_id: feature.wayId,
object_type: 'way',
road_type: feature.type
});
// Variables used in the description
d.replacements = {
percentage: feature.percentOfTrips,
num_trips: feature.numberOfTrips,
highway: linkErrorObject(t('QA.keepRight.error_parts.highway'))
};
_erCache.data[d.id] = d;
_erCache.rtree.insert(encodeErrorRtree(d));
})
@@ -182,13 +200,30 @@ export default {
data.entities.forEach(function(feature) {
var loc = feature.point;
// Elements are presented in a strange way
var ids = feature.id.split(',');
var from_way = ids[0];
var via_node = ids[3];
var to_way = ids[2].split(':')[1];
var d = new impOsmError({
loc: [loc.lon, loc.lat],
comments: null,
error_type: k,
object_id: via_node,
object_type: 'node',
turn_type: feature.turnType
});
// Variables used in the description
d.replacements = {
num_passed: feature.numberOfPasses,
num_trips: feature.segments[0].numberOfTrips,
turn_restriction: feature.turnType.toLowerCase(),
from_way: linkEntity('w' + from_way),
to_way: linkEntity('w' + to_way)
};
_erCache.data[d.id] = d;
_erCache.rtree.insert(encodeErrorRtree(d));
})
+1 -1
View File
@@ -22,7 +22,7 @@ export function uiImproveOsmDetails(context) {
var detail;
if (et && et.description) {
detail = t('QA.improveOSM.error_types.' + errorType + '.description');
detail = t('QA.improveOSM.error_types.' + errorType + '.description', d.replacements);
} else {
detail = unknown;
}