mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
2 Commits
37963b7b21
...
1e2a123693
| Author | SHA1 | Date |
|---|---|---|
|
|
1e2a123693 | |
|
|
2916afb974 |
|
|
@ -202,6 +202,23 @@ class SQLSubModel(PamhyrID):
|
||||||
self._owner_scenario = self._status.scenario_id
|
self._owner_scenario = self._status.scenario_id
|
||||||
self._status.modified()
|
self._status.modified()
|
||||||
|
|
||||||
|
def set_owner_scenario_if(self, predicate):
|
||||||
|
"""Set study status the object owner_scenario to current
|
||||||
|
scenario if predicate(scenario_id) is true
|
||||||
|
|
||||||
|
Args:
|
||||||
|
predicate: Function predicate on owner_scenario id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
"""
|
||||||
|
if self._status is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
if predicate(self._owner_scenario):
|
||||||
|
self._owner_scenario = self._status.scenario_id
|
||||||
|
self._status.modified()
|
||||||
|
|
||||||
def is_deleted(self):
|
def is_deleted(self):
|
||||||
"""This object is deleted?
|
"""This object is deleted?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,5 +82,20 @@ class PamhyrModelDict(SQLSubModel):
|
||||||
self.set(key, new)
|
self.set(key, new)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
def rec_set_owner_scenario_if(self, predicate):
|
||||||
|
"""Set study status the object owner_scenario to current
|
||||||
|
scenario if predicate(scenario_id) is true
|
||||||
|
|
||||||
|
Args:
|
||||||
|
predicate: Function predicate on owner_scenario id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
"""
|
||||||
|
self.set_owner_scenario_if(predicate)
|
||||||
|
|
||||||
|
for k in self._lst:
|
||||||
|
self._dict[key].set_owner_scenario_if(predicate)
|
||||||
|
|
||||||
def new(self, key):
|
def new(self, key):
|
||||||
raise NotImplementedMethodeError(self, self.new)
|
raise NotImplementedMethodeError(self, self.new)
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,21 @@ class PamhyrModelList(SQLSubModel):
|
||||||
if self._status is not None:
|
if self._status is not None:
|
||||||
self._status.modified()
|
self._status.modified()
|
||||||
|
|
||||||
|
def rec_set_owner_scenario_if(self, predicate):
|
||||||
|
"""Set study status the object owner_scenario to current
|
||||||
|
scenario if predicate(scenario_id) is true
|
||||||
|
|
||||||
|
Args:
|
||||||
|
predicate: Function predicate on owner_scenario id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
"""
|
||||||
|
self.set_owner_scenario_if(predicate)
|
||||||
|
|
||||||
|
for el in self._lst:
|
||||||
|
el.set_owner_scenario_if(predicate)
|
||||||
|
|
||||||
def new(self, index):
|
def new(self, index):
|
||||||
"""Create new elements and add it to list
|
"""Create new elements and add it to list
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,21 @@ class PamhyrModelList(SQLSubModel):
|
||||||
if self._status is not None:
|
if self._status is not None:
|
||||||
self._status.modified()
|
self._status.modified()
|
||||||
|
|
||||||
|
def rec_set_owner_scenario_if(self, predicate):
|
||||||
|
"""Set study status the object owner_scenario to current
|
||||||
|
scenario if predicate(scenario_id) is true
|
||||||
|
|
||||||
|
Args:
|
||||||
|
predicate: Function predicate on owner_scenario id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
"""
|
||||||
|
self.set_owner_scenario_if(predicate)
|
||||||
|
|
||||||
|
for el in self._lst:
|
||||||
|
el.set_owner_scenario_if(predicate)
|
||||||
|
|
||||||
def new(self, index):
|
def new(self, index):
|
||||||
"""Create new elements and add it to list
|
"""Create new elements and add it to list
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue