Fixed issue where polygon coords were not a list
This commit is contained in:
+13
-8
@@ -13,16 +13,21 @@ module.exports = {
|
||||
}
|
||||
// console.log(rows);
|
||||
let polygons = []
|
||||
let polygonDict = {};
|
||||
rows[0].map((point) => {
|
||||
let polygon = {};
|
||||
polygon.coords = [];
|
||||
polygon.polygonID = point.polygonID;
|
||||
polygon.coords.push({lat: point.lat, lng: point.lng});
|
||||
polygon.gameID = point.gameID;
|
||||
polygon.userID = point.userID;
|
||||
polygon.colour = point.colour;
|
||||
polygons.push(polygon);
|
||||
if (!(point.polygonID in polygonDict)) {
|
||||
polygonDict[point.polygonID] = {};
|
||||
polygonDict[point.polygonID].coords = [];
|
||||
polygonDict[point.polygonID].gameID = point.gameID;
|
||||
polygonDict[point.polygonID].userID = point.userID;
|
||||
polygonDict[point.polygonID].colour = point.colour;
|
||||
polygonDict[point.polygonID].polygonID = point.polygonID;
|
||||
}
|
||||
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);
|
||||
return;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user