diff --git a/src/Model/HydraulicStructures/HydraulicStructures.py b/src/Model/HydraulicStructures/HydraulicStructures.py index bc29b668..b71dbda4 100644 --- a/src/Model/HydraulicStructures/HydraulicStructures.py +++ b/src/Model/HydraulicStructures/HydraulicStructures.py @@ -64,6 +64,7 @@ class HydraulicStructure(SQLSubModel): @classmethod def _db_create(cls, execute): + execute(""" CREATE TABLE hydraulic_structures( id INTEGER NOT NULL PRIMARY KEY, @@ -138,6 +139,7 @@ class HydraulicStructure(SQLSubModel): return new def _db_save(self, execute, data=None): + print("save hs unit") execute(f"DELETE FROM hydraulic_structures WHERE id = {self.id}") input_reach_id = -1 diff --git a/src/Model/OutputKpAdists/OutputKpAdists.py b/src/Model/OutputKpAdists/OutputKpAdists.py index d8ab6f56..986fae1c 100644 --- a/src/Model/OutputKpAdists/OutputKpAdists.py +++ b/src/Model/OutputKpAdists/OutputKpAdists.py @@ -82,15 +82,18 @@ class OutputKpAdists(SQLSubModel): @classmethod def _db_create(cls, execute): - execute(""" - CREATE TABLE OutputKpAdists( - id INTEGER NOT NULL PRIMARY KEY, - reach INTEGER NOT NULL, - kp REAL NOT NULL, - title TEXT NOT NULL, - FOREIGN KEY(edge) REFERENCES river_reach(id) - ) - """) + + sql = ( + "CREATE TABLE OutputKpAdists(" + + "id INTEGER NOT NULL PRIMARY KEY, " + + "reach INTEGER NOT NULL, " + + "kp REAL NOT NULL, " + + "title TEXT NOT NULL, " + + "FOREIGN KEY(reach) REFERENCES river_reach(id)" + + ")" + ) + + execute(sql) return cls._create_submodel(execute) @@ -130,21 +133,14 @@ class OutputKpAdists(SQLSubModel): def _db_save(self, execute, data=None): - print("print output kp unit") - print("id : ", self.id) - print("reach : ", self._reach) - print("kp : ", self._kp) - print("title : ", self._title) - print("title format : ", self._db_format(self._title)) - execute(f"DELETE FROM OutputKpAdists WHERE id = {self.id}") sql = ( "INSERT INTO " + "OutputKpAdists(id, reach, kp, title) " + "VALUES (" + - f"{self.id}, {self._reach}, " + - f"{self._kp}, '{self._db_format(self._title)}'" + + f"{self.id}, {self._reach}, {self._kp}, " + + f"'{self._db_format(self._title)}'" + ")" ) diff --git a/src/Model/OutputKpAdists/OutputKpListAdists.py b/src/Model/OutputKpAdists/OutputKpListAdists.py index 741cb229..d6560e68 100644 --- a/src/Model/OutputKpAdists/OutputKpListAdists.py +++ b/src/Model/OutputKpAdists/OutputKpListAdists.py @@ -35,7 +35,6 @@ class OutputKpAdistsList(PamhyrModelList): return new def _db_save(self, execute, data=None): - print("save outputkpadists") ok = True # Delete previous data diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py index 42d5698c..9ca6bb06 100644 --- a/src/Model/Pollutants/Pollutants.py +++ b/src/Model/Pollutants/Pollutants.py @@ -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)}'" + diff --git a/src/Model/Pollutants/PollutantsList.py b/src/Model/Pollutants/PollutantsList.py index e2fa4404..2526329a 100644 --- a/src/Model/Pollutants/PollutantsList.py +++ b/src/Model/Pollutants/PollutantsList.py @@ -35,7 +35,6 @@ class PollutantsList(PamhyrModelList): return new def _db_save(self, execute, data=None): - print("save pollutantsList") ok = True # Delete previous data diff --git a/src/View/Pollutants/Edit/Window.py b/src/View/Pollutants/Edit/Window.py index 735d1b20..1f535191 100644 --- a/src/View/Pollutants/Edit/Window.py +++ b/src/View/Pollutants/Edit/Window.py @@ -57,7 +57,6 @@ class EditPolluantWindow(PamhyrWindow): trad = EditPollutantTranslate() name = trad[self._pamhyr_name] - print(name) if self._data is not None: name += ( f" - {study.name} " + diff --git a/tests_cases/Ardeche/Ardeche.pamhyr b/tests_cases/Ardeche/Ardeche.pamhyr index 0951c307..1efb0ae8 100644 Binary files a/tests_cases/Ardeche/Ardeche.pamhyr and b/tests_cases/Ardeche/Ardeche.pamhyr differ diff --git a/tests_cases/Ardeche/Ardeche.pamhyr-journal b/tests_cases/Ardeche/Ardeche.pamhyr-journal new file mode 100644 index 00000000..624a5f81 Binary files /dev/null and b/tests_cases/Ardeche/Ardeche.pamhyr-journal differ diff --git a/tests_cases/Enlargement/Enlargement.pamhyr b/tests_cases/Enlargement/Enlargement.pamhyr index 275fad25..529aabb0 100644 Binary files a/tests_cases/Enlargement/Enlargement.pamhyr and b/tests_cases/Enlargement/Enlargement.pamhyr differ