Scenario: Fix profile saving and loading for scenario.

This commit is contained in:
parouby committed 2025-08-15 10:08:26 +02:00
1 parent 739eb56006
commit 216239bfce
4 files changed
+41 -26

No files matched your search

+11 -7
View File
@@ -164,13 +164,15 @@ class PointXYZ(Point, SQLSubModel):
@classmethod
def _db_load(cls, execute, data=None):
new = []
status = data["status"]
profile = data["profile"]
scenario = data["scenario"]
loaded = data['loaded_pid']
if scenario is None:
return
return new
table = execute(
"SELECT pamhyr_id, deleted, " +
@@ -194,7 +196,7 @@ class PointXYZ(Point, SQLSubModel):
sl = next(it)
owner_scenario = next(it)
new = cls(
point = cls(
id=pid,
name=name,
x=x, y=y, z=z,
@@ -203,12 +205,12 @@ class PointXYZ(Point, SQLSubModel):
owner_scenario=owner_scenario
)
if deleted:
new.set_as_deleted()
point.set_as_deleted()
if sl == -1 or sl is None:
new._sl = None
point._sl = None
else:
new._sl = next(
point._sl = next(
filter(
lambda s: s.pamhyr_id == sl,
data["sediment_layers_list"].sediment_layers
@@ -216,12 +218,14 @@ class PointXYZ(Point, SQLSubModel):
)
loaded.add(pid)
yield new
new.append(point)
data["scenario"] = scenario.parent
yield from cls._db_load(execute, data)
new += cls._db_load(execute, data)
data["scenario"] = scenario
return new
def _db_save(self, execute, data=None):
if not self.must_be_saved():
return True