mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Geometry: Prepare update db 0.1.0.
This commit is contained in:
1 parent
9deccb465e
commit
1bae755f1c
4 files changed
+107
-58
No files matched your search
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user