mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Results: Fix river loading reachs creation.
This commit is contained in:
1 parent
4a6349cd9c
commit
5e3e5628d2
1 file changed
+5
-4
@@ -393,7 +393,7 @@ class Reach(SQLSubModel):
|
|||||||
class River(SQLSubModel):
|
class River(SQLSubModel):
|
||||||
_sub_classes = [Reach]
|
_sub_classes = [Reach]
|
||||||
|
|
||||||
def __init__(self, study, parent):
|
def __init__(self, study, parent, init=True):
|
||||||
super(River, self).__init__(
|
super(River, self).__init__(
|
||||||
id=-1, status=study.status,
|
id=-1, status=study.status,
|
||||||
owner_scenario=study.status.scenario.id
|
owner_scenario=study.status.scenario.id
|
||||||
@@ -404,8 +404,9 @@ class River(SQLSubModel):
|
|||||||
|
|
||||||
# Dict with timestamps as key
|
# Dict with timestamps as key
|
||||||
self._reachs = []
|
self._reachs = []
|
||||||
for i, _ in enumerate(self._study.river.enable_edges()):
|
if init:
|
||||||
self.add(i)
|
for i, _ in enumerate(self._study.river.enable_edges()):
|
||||||
|
self.add(i)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self._reachs)
|
return len(self._reachs)
|
||||||
@@ -458,7 +459,7 @@ class River(SQLSubModel):
|
|||||||
study = data["study"]
|
study = data["study"]
|
||||||
parent = data["parent"]
|
parent = data["parent"]
|
||||||
|
|
||||||
new_river = cls(study, parent)
|
new_river = cls(study, parent, init=False)
|
||||||
|
|
||||||
for reach in study.river.reachs():
|
for reach in study.river.reachs():
|
||||||
data["reach"] = reach.reach
|
data["reach"] = reach.reach
|
||||||
|
|||||||
Reference in new issue
Block a user