mirror of https://gitlab.com/pamhyr/pamhyr2
Adists: d90, dif: Fix update for scenario.
parent
7094ff3e62
commit
2faebfd402
|
|
@ -103,6 +103,29 @@ class D90AdisTSSpec(SQLSubModel):
|
||||||
execute(f"DROP TABLE {table}")
|
execute(f"DROP TABLE {table}")
|
||||||
execute(f"ALTER TABLE {table_new}_tmp RENAME TO {table_new}")
|
execute(f"ALTER TABLE {table_new}_tmp RENAME TO {table_new}")
|
||||||
|
|
||||||
|
cls._db_update_to_0_2_0_set_d90_pid(execute, data)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _db_update_to_0_2_0_set_d90_pid(cls, execute, data):
|
||||||
|
pid_d90 = data["id2pid"]["d90_adists"]
|
||||||
|
els = execute(
|
||||||
|
f"SELECT pamhyr_id, d90 FROM d90_adists_spec"
|
||||||
|
)
|
||||||
|
|
||||||
|
for row in els:
|
||||||
|
it = iter(row)
|
||||||
|
pid = next(it)
|
||||||
|
pol_id = next(it)
|
||||||
|
|
||||||
|
if pol_id == -1:
|
||||||
|
continue
|
||||||
|
|
||||||
|
execute(
|
||||||
|
f"UPDATE d90_adists_spec" +
|
||||||
|
f"SET d90 = {pid_d90[d90_id]} " +
|
||||||
|
f"WHERE pamhyr_id = {pid}"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _db_load(cls, execute, data=None):
|
def _db_load(cls, execute, data=None):
|
||||||
new = []
|
new = []
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,28 @@ class DIFAdisTSSpec(SQLSubModel):
|
||||||
execute(f"ALTER TABLE {table_new}_tmp RENAME TO {table_new}")
|
execute(f"ALTER TABLE {table_new}_tmp RENAME TO {table_new}")
|
||||||
|
|
||||||
cls._db_update_to_0_2_0_set_reach_pid(execute, table, reachs)
|
cls._db_update_to_0_2_0_set_reach_pid(execute, table, reachs)
|
||||||
|
cls._db_update_to_0_2_0_set_dif_pid(execute, data)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _db_update_to_0_2_0_set_dif_pid(cls, execute, data):
|
||||||
|
pid_dif = data["id2pid"]["dif_adists"]
|
||||||
|
els = execute(
|
||||||
|
f"SELECT pamhyr_id, dif FROM dif_adists_spec"
|
||||||
|
)
|
||||||
|
|
||||||
|
for row in els:
|
||||||
|
it = iter(row)
|
||||||
|
pid = next(it)
|
||||||
|
pol_id = next(it)
|
||||||
|
|
||||||
|
if pol_id == -1:
|
||||||
|
continue
|
||||||
|
|
||||||
|
execute(
|
||||||
|
f"UPDATE dif_adists_spec" +
|
||||||
|
f"SET dif = {pid_dif[dif_id]} " +
|
||||||
|
f"WHERE pamhyr_id = {pid}"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _db_load(cls, execute, data=None):
|
def _db_load(cls, execute, data=None):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue