mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Model: Fix possible data removing durring save.
This commit is contained in:
1 parent
51858597cd
commit
d891c9783d
4 files changed
+16
-7
No files matched your search
@@ -173,11 +173,13 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
points = self.points
|
||||
|
||||
data["profile"] = self
|
||||
execute(f"DELETE FROM geometry_pointXYZ WHERE profile = {self.id}")
|
||||
|
||||
ind = 0
|
||||
for point in self.points:
|
||||
for point in points:
|
||||
data["ind"] = ind
|
||||
ok &= point._db_save(execute, data)
|
||||
ind += 1
|
||||
|
||||
@@ -71,15 +71,16 @@ class Reach(SQLSubModel):
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
profiles = self.profiles
|
||||
|
||||
# Delete old data
|
||||
execute(f"DELETE FROM geometry_profileXYZ WHERE reach = {self.id}")
|
||||
# execute(f"DELETE FROM geometry_pointXYZ")
|
||||
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
ind = 0
|
||||
for profile in self.profiles:
|
||||
for profile in profiles:
|
||||
data["ind"] = ind
|
||||
profile._db_save(execute, data)
|
||||
ind += 1
|
||||
|
||||
Reference in new issue
Block a user