mirror of https://gitlab.com/pamhyr/pamhyr2
Result: Fix db load profiles list.
parent
26d1d63edb
commit
5f5a47679d
|
|
@ -196,7 +196,7 @@ class Profile(SQLSubModel):
|
||||||
class Reach(SQLSubModel):
|
class Reach(SQLSubModel):
|
||||||
_sub_classes = [Profile]
|
_sub_classes = [Profile]
|
||||||
|
|
||||||
def __init__(self, reach, study):
|
def __init__(self, reach, study, with_init=True):
|
||||||
super(Reach, self).__init__(
|
super(Reach, self).__init__(
|
||||||
id=-1, status=study.status,
|
id=-1, status=study.status,
|
||||||
owner_scenario=study.status.scenario.id
|
owner_scenario=study.status.scenario.id
|
||||||
|
|
@ -204,6 +204,8 @@ class Reach(SQLSubModel):
|
||||||
|
|
||||||
self._study = study
|
self._study = study
|
||||||
self._reach = reach # Source reach in the study
|
self._reach = reach # Source reach in the study
|
||||||
|
self._profiles = []
|
||||||
|
if with_init:
|
||||||
self._profiles = list(
|
self._profiles = list(
|
||||||
map(
|
map(
|
||||||
lambda p: Profile(p, self._study),
|
lambda p: Profile(p, self._study),
|
||||||
|
|
@ -253,9 +255,7 @@ class Reach(SQLSubModel):
|
||||||
|
|
||||||
for profile in reach.profiles:
|
for profile in reach.profiles:
|
||||||
data["profile"] = profile
|
data["profile"] = profile
|
||||||
new_reach._profiles.append(
|
new_reach._profiles += Profile._db_load(execute, data)
|
||||||
Profile._db_load(execute, data)
|
|
||||||
)
|
|
||||||
|
|
||||||
return new_reach
|
return new_reach
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue