mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
update model + view to display only BCAdisTS related to pollutant, and not the global list, todo: reconnect add/del buttons
This commit is contained in:
1 parent
63836527c7
commit
23361d142e
6 files changed
+66
-61
No files matched your search
@@ -312,6 +312,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
status = data['status']
|
||||
nodes = data['nodes']
|
||||
scenario = data["scenario"]
|
||||
pollutant = data["pollutant"]
|
||||
loaded = data['loaded_pid']
|
||||
|
||||
if scenario is None:
|
||||
@@ -321,7 +322,8 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||
"SELECT pamhyr_id, deleted, pollutant, type, node, scenario " +
|
||||
"FROM boundary_condition_adists " +
|
||||
f"WHERE scenario = {scenario.id} " +
|
||||
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) "
|
||||
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) " +
|
||||
f"AND pollutant = {pollutant.id} "
|
||||
)
|
||||
|
||||
if table is not None:
|
||||
|
||||
@@ -28,6 +28,7 @@ from tools import (
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
from Model.Scenario import Scenario
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS import BoundaryConditionAdisTS
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
@@ -275,7 +276,8 @@ class PollutantCharacteristics(SQLSubModel):
|
||||
|
||||
|
||||
class Pollutants(SQLSubModel):
|
||||
_sub_classes = [PollutantCharacteristics]
|
||||
_sub_classes = [PollutantCharacteristics,
|
||||
BoundaryConditionAdisTS]
|
||||
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None, owner_scenario=-1):
|
||||
@@ -293,6 +295,11 @@ class Pollutants(SQLSubModel):
|
||||
self._enabled = True
|
||||
|
||||
self._data = []
|
||||
self._boundary_conditions_adists = []
|
||||
|
||||
@property
|
||||
def boundary_conditions_adists(self):
|
||||
return self._boundary_conditions_adists
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -415,6 +422,10 @@ class Pollutants(SQLSubModel):
|
||||
new_pollutant._data = PollutantCharacteristics._db_load(
|
||||
execute, data=data
|
||||
)
|
||||
|
||||
new_pollutant._boundary_conditions_adists = BoundaryConditionAdisTS._db_load(
|
||||
execute, data=data
|
||||
)
|
||||
|
||||
loaded.add(pid)
|
||||
new.append(new_pollutant)
|
||||
@@ -455,6 +466,9 @@ class Pollutants(SQLSubModel):
|
||||
for d in self._data:
|
||||
ok &= d._db_save(execute, data)
|
||||
|
||||
for bc in self._boundary_conditions_adists:
|
||||
ok &= bc._db_save(execute, data)
|
||||
|
||||
return ok
|
||||
|
||||
def _data_traversal(self,
|
||||
|
||||
Reference in new issue
Block a user