[Lada-commits] [PATCH] Flatten the JSON-data in order to prozess Orte
Wald Commits
scm-commit at wald.intevation.org
Thu Dec 15 12:41:18 CET 2016
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1481802022 -3600
# Node ID c4059495a346fb6de70a1c89a99f70f47125e31c
# Parent a4c1a9862a88b484b22b1504555d6b386e450d24
Flatten the JSON-data in order to prozess Orte
diff -r a4c1a9862a88 -r c4059495a346 app/controller/grid/ProbeList.js
--- a/app/controller/grid/ProbeList.js Wed Dec 14 10:21:48 2016 +0100
+++ b/app/controller/grid/ProbeList.js Thu Dec 15 12:40:22 2016 +0100
@@ -178,7 +178,6 @@
data = JSON.parse(data);
// ensure data and prep are equal, not sure
// if json.parse changes order of things
- console.log(data);
emptyMessstelle = {
"id": null,
@@ -204,10 +203,12 @@
"s11": null
};
- for (i in data) {
+ for (var i in data) {
probe = data[i];
deskriptoren = probe.deskriptoren;
messstelle = probe.messstelle;
+ ortszuordnung = probe.ortszuordnung;
+
if (messstelle != null) {
prep[i].messstelle = [];
prep[i].messstelle[0] = messstelle;
@@ -225,7 +226,19 @@
prep[i].deskriptoren = [];
prep[i].deskriptoren[0] = emptyDeskriptor;
}
+
+ debugger;
+
+ // Flatten the Ortszuodnung Array
+ for (var o in ortszuordnung) {
+ oz = ortszuordnung[o];
+ for (var e in oz.ort) {
+ prep[i].ortszuordnung[o]['ort']=null;
+ prep[i].ortszuordnung[o]['ort.'+e]=oz.ort[e];
+ }
+ }
}
+
return JSON.stringify(prep);
},
More information about the Lada-commits
mailing list