BC AdisTS Complete

This commit is contained in:
Youcef AOUAD committed 2024-06-18 15:40:06 +02:00
1 parent b927aa81b3
commit 704130966e
13 files changed
+198 -478

No files matched your search

@@ -105,7 +105,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
bc.node = None
if row[3] != -1:
bc.node = next(filter(lambda n: n.id == row[3], data["nodes"]))
bc.node = next(filter(lambda n: n.id == row[3], data["nodes"])).id
values = execute(
"SELECT data0, data1 FROM boundary_condition_data_adists " +
@@ -114,8 +114,8 @@ class BoundaryConditionAdisTS(SQLSubModel):
# Write data
for v in values:
data0 = bc._types[0](v[1])
data1 = bc._types[1](v[2])
data0 = bc._types[0](v[0])
data1 = bc._types[1](v[1])
# Replace data at pos ind
bc._data.append((data0, data1))
@@ -124,20 +124,19 @@ class BoundaryConditionAdisTS(SQLSubModel):
return new
def _db_save(self, execute, data=None):
pollutant_id = data["pollutant_id"]
execute(f"DELETE FROM boundary_condition_adists WHERE id = {self.id}")
execute(f"DELETE FROM boundary_condition_data_adists WHERE bc = {self.id}")
node = -1
if self._node is not None:
node = self._node.id
node = self._node
sql = (
"INSERT INTO " +
"boundary_condition_adists(id, pollutant, type, node) " +
"VALUES (" +
f"{self.id}, {pollutant_id}, " +
f"{self.id}, {self._pollutant}, " +
f"'{self._db_format(self._type)}', {node}" +
")"
)
@@ -188,6 +187,11 @@ class BoundaryConditionAdisTS(SQLSubModel):
def header(self):
return self._header.copy()
@header.setter
def header(self, header):
self._header = header
self._status.modified()
@property
def pollutant(self):
return self._pollutant