mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Result: Fix db load profiles list.
This commit is contained in:
1 parent
26d1d63edb
commit
5f5a47679d
1 file changed
+9
-9
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user