Commit 3ce8f723 authored by Christoffer Stoll's avatar Christoffer Stoll
Browse files

Fixed sorting bug for e1a and e2a

parent 57a6a8cf
......@@ -7,14 +7,16 @@ from library.utils import *
class Observation:
id = None,
id = None
namespace = None
prefix = None
sampling_point_id = None
cnt = None
vals = None
concentration = None
timestep = None,
timestep = None
min_begin_position = None
max_begin_position = None
min_end_position = None
max_end_position = None
process_id = None
......@@ -27,7 +29,7 @@ class Observation:
obs = ET.SubElement(fm, "{" + Namespaces.om + "}OM_Observation", {ET.QName(Namespaces.gml, "id"): self.prefix + "_" + self.id})
pt = ET.SubElement(obs, "{" + Namespaces.om + "}phenomenonTime")
pt.append(TimePeriod(self.prefix + "_" + self.id, self.min_end_position, self.max_end_position).as_element())
pt.append(TimePeriod(self.prefix + "_" + self.id, self.min_begin_position, self.max_end_position).as_element())
rt = ET.SubElement(obs, "{" + Namespaces.om + "}resultTime")
ti = ET.SubElement(rt, "{" + Namespaces.gml + "}TimeInstant", {ET.QName(Namespaces.gml, "id"): "TimeInstant_" + self.prefix + "_" + self.id})
......
......@@ -51,10 +51,10 @@ class E1AGetHandler:
def get_observations(self, p):
sql = """
select max(c.id) id, c.process_id,s.assessment_type,c.pollutant, c.sample_id,
elect max(c.id) id, c.process_id,s.assessment_type,c.pollutant, c.sample_id,
o.sampling_point_id, o.concentration, o.timestep,
count(o.sampling_point_id) cnt, min(o.end_position) min_end_position, max(o.end_position) max_end_position,
string_agg(o.begin_position || ',' || o.end_position || ',' || o.verification_flag || ',' || o.validation_flag || ',' || o.value,'@@') vals
count(o.sampling_point_id) cnt, min(o.begin_position) min_begin_position, max(o.begin_position) max_begin_position,min(o.end_position) min_end_position, max(o.end_position) max_end_position,
string_agg(o.begin_position || ',' || o.end_position || ',' || o.verification_flag || ',' || o.validation_flag || ',' || o.value,'@@' order by o.begin_position) vals
from observations o, sampling_points s, observing_capabilities c
where o.sampling_point_id = s.id
and c.sampling_point_id = s.id
......
......@@ -50,8 +50,8 @@ class E2AGetHandler:
sql = """
select max(c.id) id, c.process_id,s.assessment_type,c.pollutant, c.sample_id,
o.sampling_point_id, o.concentration, o.timestep,
count(o.sampling_point_id) cnt, min(o.end_position) min_end_position, max(o.end_position) max_end_position,
string_agg(o.begin_position || ',' || o.end_position || ',' || o.verification_flag || ',' || o.validation_flag || ',' || o.value,'@@') vals
count(o.sampling_point_id) cnt, min(o.begin_position) min_begin_position, max(o.begin_position) max_begin_position,min(o.end_position) min_end_position, max(o.end_position) max_end_position,
string_agg(o.begin_position || ',' || o.end_position || ',' || o.verification_flag || ',' || o.validation_flag || ',' || o.value,'@@' order by o.begin_position) vals
from observations o, sampling_points s, observing_capabilities c
where o.sampling_point_id = s.id
and c.sampling_point_id = s.id
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment