Fixed issue where polygon coords were not a list

main
Umbra Sheep 7 years ago
commit ad2c57c78d

@ -13,16 +13,21 @@ module.exports = {
} }
// console.log(rows); // console.log(rows);
let polygons = [] let polygons = []
let polygonDict = {};
rows[0].map((point) => { rows[0].map((point) => {
let polygon = {}; if (!(point.polygonID in polygonDict)) {
polygon.coords = []; polygonDict[point.polygonID] = {};
polygon.polygonID = point.polygonID; polygonDict[point.polygonID].coords = [];
polygon.coords.push({lat: point.lat, lng: point.lng}); polygonDict[point.polygonID].gameID = point.gameID;
polygon.gameID = point.gameID; polygonDict[point.polygonID].userID = point.userID;
polygon.userID = point.userID; polygonDict[point.polygonID].colour = point.colour;
polygon.colour = point.colour; polygonDict[point.polygonID].polygonID = point.polygonID;
polygons.push(polygon); }
polygonDict[point.polygonID].coords.push({lat: point.lat, lng: point.lng});
}); });
for (let [polygon, polygonData] of Object.entries(polygonDict)){
polygons.push(polygonDict[polygon]);
}
res.send(polygons); res.send(polygons);
return; return;
}); });

Loading…
Cancel
Save