mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pollutants edit db
This commit is contained in:
1 parent
37dd4ebaef
commit
1535247e1b
9 files changed
+19
-25
No files matched your search
@@ -86,6 +86,7 @@ class Pollutants(SQLSubModel):
|
||||
apd REAL NOT NULL,
|
||||
ac REAL NOT NULL,
|
||||
bc REAL NOT NULL,
|
||||
pollutant INTEGER NOT NULL,
|
||||
FOREIGN KEY(pollutant) REFERENCES Pollutants(id)
|
||||
)
|
||||
""")
|
||||
@@ -126,7 +127,7 @@ class Pollutants(SQLSubModel):
|
||||
|
||||
if table is not None:
|
||||
for t in table:
|
||||
new_data.append(t)
|
||||
new_data = t[1:]
|
||||
|
||||
new_pollutant._data.append(new_data)
|
||||
|
||||
@@ -136,14 +137,12 @@ class Pollutants(SQLSubModel):
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
|
||||
print("save in data base for pollutants")
|
||||
|
||||
execute(f"DELETE FROM Pollutants WHERE id = {self.id}")
|
||||
execute(f"DELETE FROM Pollutants_characteristics WHERE pollutant = {self.id}")
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
"Pollutants(id, name " +
|
||||
"Pollutants(id, name) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, " +
|
||||
f"'{self._db_format(self._name)}'" +
|
||||
|
||||
@@ -35,7 +35,6 @@ class PollutantsList(PamhyrModelList):
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
print("save pollutantsList")
|
||||
ok = True
|
||||
|
||||
# Delete previous data
|
||||
|
||||
Reference in new issue
Block a user