debug pollutants model and save in db

disable_edition_parent_scenario
Dylan Jeannin 2026-05-20 17:17:51 +02:00
parent 1989914aef
commit 63b5cbaba7
2 changed files with 14 additions and 2 deletions

View File

@ -104,6 +104,12 @@ class PollutantCharacteristics(SQLSubModel):
self._ac = value self._ac = value
elif key == 8: elif key == 8:
self._bc = value self._bc = value
self.propagate_modified()
def propagate_modified(self):
self.modified()
if hasattr(self, "_pollutant") and self._pollutant:
self._pollutant.modified()
@classmethod @classmethod
def _db_create(cls, execute, ext=""): def _db_create(cls, execute, ext=""):
@ -256,6 +262,12 @@ class PollutantCharacteristics(SQLSubModel):
if not self.must_be_saved(): if not self.must_be_saved():
return True return True
execute(
"DELETE FROM pollutants_characteristics " +
f"WHERE pamhyr_id = {self.id} " +
f"AND scenario = {self._status.scenario_id}"
)
execute( execute(
"INSERT INTO " + "INSERT INTO " +
"pollutants_characteristics(pamhyr_id, deleted, " + "pollutants_characteristics(pamhyr_id, deleted, " +
@ -312,7 +324,7 @@ class Pollutants(SQLSubModel):
@name.setter @name.setter
def name(self, name): def name(self, name):
self._name = name self._name = name
self._status.modified() self.modified()
@property @property
def data(self): def data(self):

View File

@ -19,7 +19,7 @@
from tools import trace, timer from tools import trace, timer
from Model.Except import NotImplementedMethodeError from Model.Except import NotImplementedMethodeError
from Model.Tools.PamhyrList import PamhyrModelList from Model.Tools.PamhyrListExt import PamhyrModelList
from Model.Pollutants.Pollutants import Pollutants from Model.Pollutants.Pollutants import Pollutants