mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Simplify db load.
parent
f0ccf1f4f7
commit
936bfc753a
|
|
@ -119,16 +119,13 @@ class Results(SQLSubModel):
|
||||||
study = data['study']
|
study = data['study']
|
||||||
status = data['status']
|
status = data['status']
|
||||||
scenario = data["scenario"]
|
scenario = data["scenario"]
|
||||||
loaded = data['loaded_pid']
|
|
||||||
|
|
||||||
values = execute(
|
values = execute(
|
||||||
"SELECT pamhyr_id, solver_name, solver_type, " +
|
"SELECT pamhyr_id, solver_name, solver_type, " +
|
||||||
"study_revision, creation_data, nb_timestamps, timestamps, " +
|
"study_revision, creation_data, nb_timestamps, timestamps, " +
|
||||||
"scenario " +
|
"scenario " +
|
||||||
"FROM results " +
|
"FROM results " +
|
||||||
f"WHERE scenario = {scenario.id} " +
|
f"WHERE scenario = {scenario.id}"
|
||||||
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) " +
|
|
||||||
"ORDER BY ind ASC"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for v in values:
|
for v in values:
|
||||||
|
|
@ -155,9 +152,9 @@ class Results(SQLSubModel):
|
||||||
ts = struct.unpack(sf, timestamp_bytes)
|
ts = struct.unpack(sf, timestamp_bytes)
|
||||||
new_results.set("timestamps", ts)
|
new_results.set("timestamps", ts)
|
||||||
|
|
||||||
|
data["timestamps"] = ts
|
||||||
new_results._river = River._db_load(execute, data)
|
new_results._river = River._db_load(execute, data)
|
||||||
|
|
||||||
loaded.add(pid)
|
|
||||||
new.append(new_results)
|
new.append(new_results)
|
||||||
|
|
||||||
return new
|
return new
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue