mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Adists: Continue to prepare scenario.
This commit is contained in:
1 parent
37cf42c524
commit
ae49908a42
8 files changed
+22
-5
No files matched your search
@@ -27,6 +27,7 @@ from tools import (
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
from Model.Scenario import Scenario
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
@@ -195,19 +196,28 @@ class LateralContributionAdisTS(SQLSubModel):
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
if not self.must_be_saved():
|
||||
return True
|
||||
|
||||
execute(f"DELETE FROM lateral_contribution_adists" +
|
||||
f" WHERE id = {self.id}")
|
||||
execute(f"DELETE FROM lateral_contribution_data_adists" +
|
||||
f" WHERE lc = {self.id}")
|
||||
execute(
|
||||
f"DELETE FROM lateral_contribution_adists" +
|
||||
f" WHERE id = {self.id} " +
|
||||
f"AND scenario = {self._status.scenario_id}"
|
||||
)
|
||||
execute(
|
||||
f"DELETE FROM lateral_contribution_data_adists" +
|
||||
f" WHERE lc = {self.id} " +
|
||||
f"AND scenario = {self._status.scenario_id}"
|
||||
)
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
"lateral_contribution_adists(id, " +
|
||||
"pollutant, edge, begin_rk, end_rk) " +
|
||||
"pollutant, reach, begin_rk, end_rk, scenario) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, {self._pollutant}, {self.edge}, " +
|
||||
f"{self._begin_rk}, {self._end_rk}" +
|
||||
f"{self._status.scenario_id}" +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
Reference in new issue
Block a user