mirror of https://gitlab.com/pamhyr/pamhyr2
debug pollutants model and save in db
parent
1989914aef
commit
63b5cbaba7
|
|
@ -104,6 +104,12 @@ class PollutantCharacteristics(SQLSubModel):
|
|||
self._ac = value
|
||||
elif key == 8:
|
||||
self._bc = value
|
||||
self.propagate_modified()
|
||||
|
||||
def propagate_modified(self):
|
||||
self.modified()
|
||||
if hasattr(self, "_pollutant") and self._pollutant:
|
||||
self._pollutant.modified()
|
||||
|
||||
@classmethod
|
||||
def _db_create(cls, execute, ext=""):
|
||||
|
|
@ -256,6 +262,12 @@ class PollutantCharacteristics(SQLSubModel):
|
|||
if not self.must_be_saved():
|
||||
return True
|
||||
|
||||
execute(
|
||||
"DELETE FROM pollutants_characteristics " +
|
||||
f"WHERE pamhyr_id = {self.id} " +
|
||||
f"AND scenario = {self._status.scenario_id}"
|
||||
)
|
||||
|
||||
execute(
|
||||
"INSERT INTO " +
|
||||
"pollutants_characteristics(pamhyr_id, deleted, " +
|
||||
|
|
@ -312,7 +324,7 @@ class Pollutants(SQLSubModel):
|
|||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = name
|
||||
self._status.modified()
|
||||
self.modified()
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
from tools import trace, timer
|
||||
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
from Model.Tools.PamhyrList import PamhyrModelList
|
||||
from Model.Tools.PamhyrListExt import PamhyrModelList
|
||||
from Model.Pollutants.Pollutants import Pollutants
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue