Mercurial > lada > lada-client
diff app/controller/grid/ProbeList.js @ 1266:c4059495a346
Flatten the JSON-data in order to prozess Orte
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 15 Dec 2016 12:40:22 +0100 |
parents | 52ecf67e9e80 |
children | e9a624998179 |
line wrap: on
line diff
--- 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); },