Results: Simplify db load.

scenarios
Pierre-Antoine 2025-09-23 10:23:20 +02:00
parent f0ccf1f4f7
commit 936bfc753a
1 changed files with 2 additions and 5 deletions

View File

@ -119,16 +119,13 @@ class Results(SQLSubModel):
study = data['study']
status = data['status']
scenario = data["scenario"]
loaded = data['loaded_pid']
values = execute(
"SELECT pamhyr_id, solver_name, solver_type, " +
"study_revision, creation_data, nb_timestamps, timestamps, " +
"scenario " +
"FROM results " +
f"WHERE scenario = {scenario.id} " +
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) " +
"ORDER BY ind ASC"
f"WHERE scenario = {scenario.id}"
)
for v in values:
@ -155,9 +152,9 @@ class Results(SQLSubModel):
ts = struct.unpack(sf, timestamp_bytes)
new_results.set("timestamps", ts)
data["timestamps"] = ts
new_results._river = River._db_load(execute, data)
loaded.add(pid)
new.append(new_results)
return new