aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-09-07 08:22:35 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-09-07 08:23:53 +0100
commitf57adcb38568a0321f349cd823fbd2578eacb2ef (patch)
tree4005918ba12fbfc39cb26609fda53405be1a5d78 /web/js/map-OpenLayers.js
parent3216bd52e77a3997e8826d34ccdab5d1d875a9fa (diff)
Make sure pin ID is an integer.
The JavaScript assumes it is, but due to a string comparison in DBIx::Class [1] when a has_many prefetch is in use (as it is on a /reports page when a shortlist-using staff user is logged in) all IDs bar the first were being given an internal string value and JSON encoding was outputting them as a string. [1] https://github.com/dbsrgits/dbix-class/blob/v0.08209/lib/DBIx/Class/ResultSet.pm#L1331
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index dc65f750d..8cc2e8e2c 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -82,12 +82,13 @@ var fixmystreet = fixmystreet || {};
fixmystreet.map.getProjectionObject()
);
}
- var marker_size = (pin[3] === window.selected_problem_id) ? selected_size : size;
+ var id = +pin[3];
+ var marker_size = (id === window.selected_problem_id) ? selected_size : size;
var marker = new OpenLayers.Feature.Vector(loc, {
colour: pin[2],
size: pin[5] || marker_size,
faded: 0,
- id: pin[3],
+ id: id,
title: pin[4] || '',
draggable: pin[6] === false ? false : true
});