From cb5db3ddddc80f9e705e1727a4b356790d7c4a98 Mon Sep 17 00:00:00 2001 From: Lukas-Heiligenbrunner Date: Fri, 28 Feb 2020 09:13:42 +0100 Subject: [PATCH] ids as Value and not String --- .../website/datarequests/DeviceRequest.kt | 6 +++--- src/resources/wwwroot/js/device.js | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/java/com/wasteinformationserver/website/datarequests/DeviceRequest.kt b/src/java/com/wasteinformationserver/website/datarequests/DeviceRequest.kt index 0c38de1..720e191 100644 --- a/src/java/com/wasteinformationserver/website/datarequests/DeviceRequest.kt +++ b/src/java/com/wasteinformationserver/website/datarequests/DeviceRequest.kt @@ -28,19 +28,19 @@ class DeviceRequest : PostRequest() { val deviceid = deviceset.getInt("DeviceID") val cityid = deviceset.getInt("CityID") if (cityid == -1) { - sb.append("{\"deviceid\":\"").append(deviceid).append("\",\"cityid\":\"").append(cityid).append("\"}") + sb.append("{\"deviceid\":").append(deviceid).append(",\"cityid\":").append(cityid).append("}") } else { val devicename = deviceset.getString("DeviceName") val devicelocation = deviceset.getString("DeviceLocation") - sb.append("{\"deviceid\":\"").append(deviceid).append("\",\"devicename\":\"").append(devicename).append("\",\"devicelocation\":\"").append(devicelocation).append("\",\"devices\":[") + sb.append("{\"deviceid\":").append(deviceid).append(",\"devicename\":\"").append(devicename).append("\",\"devicelocation\":\"").append(devicelocation).append("\",\"devices\":[") val devicecities = jdbc.executeQuery("SELECT * FROM `device_city` INNER JOIN `cities` ON device_city.CityID=cities.id WHERE `DeviceID`='$deviceid'") while (devicecities.next()) { val cityidd = devicecities.getInt("id") val cityname = devicecities.getString("name") val wastetype = devicecities.getString("wastetype") val zone = devicecities.getString("zone") - sb.append("{\"cityid\":\"").append(cityidd).append("\",\"cityname\":\"").append(cityname).append("\",\"wastetype\":\"").append(wastetype).append("\",\"zone\":\"").append(zone).append("\"}") + sb.append("{\"cityid\":").append(cityidd).append(",\"cityname\":\"").append(cityname).append("\",\"wastetype\":\"").append(wastetype).append("\",\"zone\":\"").append(zone).append("\"}") if (!devicecities.isLast) { sb.append(",") } diff --git a/src/resources/wwwroot/js/device.js b/src/resources/wwwroot/js/device.js index 4f2b926..afabe17 100644 --- a/src/resources/wwwroot/js/device.js +++ b/src/resources/wwwroot/js/device.js @@ -36,7 +36,6 @@ class Device { var devicelocation = data.data[i].devicelocation; var row = "" + id + "" + devicename + "" + devicelocation + ""; - for (var n = 0; n < data.data[i].devices.length; n++) { var cityname = data.data[i].devices[n].cityname; var cityzone = data.data[i].devices[n].zone;