Geometry: Prepare update db 0.1.0.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-07-29 14:00:14 +02:00
1 parent 9deccb465e
commit 1bae755f1c
4 files changed
+107 -58

No files matched your search

+5 -13
View File
@@ -75,8 +75,10 @@ class Reach(SQLSubModel):
def _db_save(self, execute, data=None):
profiles = self.profiles
# Delete old data
execute(f"DELETE FROM geometry_profileXYZ WHERE reach = {self.id}")
execute(
"DELETE FROM geometry_profileXYZ " +
f"WHERE reach = {self.pamhyr_id}"
)
if data is None:
data = {}
@@ -111,18 +113,8 @@ class Reach(SQLSubModel):
return self._parent.name
def _get_profiles_list(self):
# Profiles list generator is type (int, Point) with the first
# element the index of the Point in list
logger.debug(f"Load profiles from reach {self.name}")
return list(
map(
lambda p: p[1],
sorted(
self._profiles,
key=lambda p: p[0]
)
)
)
return list(self._profiles)
def __len__(self):
if not isinstance(self._profiles, list):