mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Adists: D90, DIF: Fix update for scenario.
This commit is contained in:
1 parent
93340a48b1
commit
23a0bc33fa
4 files changed
+35
-19
No files matched your search
@@ -74,12 +74,16 @@ class DIFAdisTS(SQLSubModel):
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version, data=None):
|
||||
major, minor, release = version.strip().split(".")
|
||||
created = False
|
||||
|
||||
if major == "0" and int(minor) <= 1:
|
||||
if int(release) < 6:
|
||||
cls._db_create(execute)
|
||||
created = True
|
||||
|
||||
elif major == "0" and int(minor) < 2:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
if major == "0" and int(minor) < 2:
|
||||
if not created:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
|
||||
return True
|
||||
|
||||
@@ -90,7 +94,7 @@ class DIFAdisTS(SQLSubModel):
|
||||
cls.update_db_add_pamhyr_id(execute, table, data)
|
||||
Scenario.update_db_add_scenario(execute, table)
|
||||
|
||||
cls._db_create_lca(execute, ext="_tmp")
|
||||
cls._db_create(execute, ext="_tmp")
|
||||
|
||||
execute(
|
||||
f"INSERT INTO {table}_tmp " +
|
||||
@@ -146,7 +150,7 @@ class DIFAdisTS(SQLSubModel):
|
||||
dif.enabled = enabled
|
||||
|
||||
data['dif_default_id'] = pid
|
||||
dif._data = difAdisTSSpec._db_load(execute, data)
|
||||
dif._data = DIFAdisTSSpec._db_load(execute, data)
|
||||
|
||||
loaded.add(pid)
|
||||
new.append(dif)
|
||||
|
||||
@@ -80,12 +80,16 @@ class DIFAdisTSSpec(SQLSubModel):
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version, data=None):
|
||||
major, minor, release = version.strip().split(".")
|
||||
created = False
|
||||
|
||||
if major == 0 and minor < 1:
|
||||
if int(release) < 6:
|
||||
cls._db_create(execute)
|
||||
created = True
|
||||
|
||||
if major == "0" and int(minor) < 2:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
if not created:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
|
||||
return True
|
||||
|
||||
@@ -98,7 +102,7 @@ class DIFAdisTSSpec(SQLSubModel):
|
||||
cls.update_db_add_pamhyr_id(execute, table, data)
|
||||
Scenario.update_db_add_scenario(execute, table)
|
||||
|
||||
cls._db_create_lca(execute, ext="_tmp")
|
||||
cls._db_create(execute, ext="_tmp")
|
||||
|
||||
execute(
|
||||
f"INSERT INTO {table_new}_tmp " +
|
||||
@@ -123,9 +127,9 @@ class DIFAdisTSSpec(SQLSubModel):
|
||||
return new
|
||||
|
||||
table = execute(
|
||||
"SELECT id, method, reach, start_rk, end_rk, " +
|
||||
"SELECT pamhyr_id, method, reach, start_rk, end_rk, " +
|
||||
"dif, b, c, enabled, scenario " +
|
||||
"FROM dif_spec " +
|
||||
"FROM dif_adists_spec " +
|
||||
f"WHERE dif_default = {data['dif_default_id']} " +
|
||||
f"AND scenario = {scenario.id} " +
|
||||
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) "
|
||||
@@ -178,7 +182,7 @@ class DIFAdisTSSpec(SQLSubModel):
|
||||
|
||||
execute(
|
||||
"INSERT INTO " +
|
||||
"dif_spec(id, dif_default, method, reach, " +
|
||||
"dif_adists_spec(pamhyr_id, dif_default, method, reach, " +
|
||||
"start_rk, end_rk, dif, b, c, enabled, scenario) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, {dif_default}, " +
|
||||
|
||||
Reference in new issue
Block a user