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):
|
||||
_sub_classes = [Profile]
|
||||
|
||||
def __init__(self, reach, study):
|
||||
def __init__(self, reach, study, with_init=True):
|
||||
super(Reach, self).__init__(
|
||||
id=-1, status=study.status,
|
||||
owner_scenario=study.status.scenario.id
|
||||
|
|
@ -204,12 +204,14 @@ class Reach(SQLSubModel):
|
|||
|
||||
self._study = study
|
||||
self._reach = reach # Source reach in the study
|
||||
self._profiles = list(
|
||||
map(
|
||||
lambda p: Profile(p, self._study),
|
||||
reach.profiles
|
||||
self._profiles = []
|
||||
if with_init:
|
||||
self._profiles = list(
|
||||
map(
|
||||
lambda p: Profile(p, self._study),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def __len__(self):
|
||||
return len(self._profiles)
|
||||
|
|
@ -253,9 +255,7 @@ class Reach(SQLSubModel):
|
|||
|
||||
for profile in reach.profiles:
|
||||
data["profile"] = profile
|
||||
new_reach._profiles.append(
|
||||
Profile._db_load(execute, data)
|
||||
)
|
||||
new_reach._profiles += Profile._db_load(execute, data)
|
||||
|
||||
return new_reach
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue