mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Adists: d90, dif, BC: Add deleted tag in DB.
This commit is contained in:
1 parent
8b4ff41b96
commit
0ed7660e72
8 files changed
+90
-30
No files matched your search
@@ -64,6 +64,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
execute(f"""
|
||||
CREATE TABLE boundary_condition_adists{ext}(
|
||||
{cls.create_db_add_pamhyr_id()},
|
||||
deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
pollutant INTEGER NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
node INTEGER,
|
||||
@@ -205,7 +206,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
return new
|
||||
|
||||
table = execute(
|
||||
"SELECT pamhyr_id, pollutant, type, node, scenario " +
|
||||
"SELECT pamhyr_id, deleted, pollutant, type, node, scenario " +
|
||||
"FROM boundary_condition_adists " +
|
||||
f"WHERE scenario = {scenario.id} " +
|
||||
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) "
|
||||
@@ -216,6 +217,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
it = iter(row)
|
||||
|
||||
pid = next(it)
|
||||
deleted = (next(it) == 1)
|
||||
pollutant = next(it)
|
||||
bc_type = next(it)
|
||||
node = next(it)
|
||||
@@ -227,6 +229,8 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
status=status,
|
||||
owner_scenario=owner_scenario
|
||||
)
|
||||
if deleted:
|
||||
bc.set_as_deleted()
|
||||
|
||||
bc.type = bc_type
|
||||
|
||||
@@ -287,10 +291,12 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
|
||||
execute(
|
||||
"INSERT INTO " +
|
||||
"boundary_condition_adists(id, pollutant, type, " +
|
||||
"boundary_condition_adists(" +
|
||||
"pamhyr_id, deleted, pollutant, type, " +
|
||||
"node, scenario) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, {self._pollutant}, " +
|
||||
f"{self.id}, {self._db_format(self.is_deleted())}, " +
|
||||
f"{self._pollutant}, " +
|
||||
f"'{self._db_format(self._type)}', {node}, " +
|
||||
f"{self._status.scenario_id}" +
|
||||
")"
|
||||
@@ -302,7 +308,8 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
|
||||
execute(
|
||||
"INSERT INTO " +
|
||||
"boundary_condition_data_adists(data0, data1, bc, scenario) " +
|
||||
"boundary_condition_data_adists(" +
|
||||
"data0, data1, bc, scenario) " +
|
||||
f"VALUES ('{data0}', {data1}, {self.id}, " +
|
||||
f"{self._status.scenario_id})"
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user