From f57adcb38568a0321f349cd823fbd2578eacb2ef Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 7 Sep 2017 08:22:35 +0100 Subject: 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 --- web/js/map-OpenLayers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'web/js/map-OpenLayers.js') 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 }); -- cgit v1.2.3