mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Friction: Fix load method in case of multiple reaches.
This commit is contained in:
1 parent
5ab06dbe51
commit
45ee8a9662
7 files changed
+36
-21
No files matched your search
@@ -16,10 +16,13 @@
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
class Friction(SQLSubModel):
|
||||
def __init__(self, name: str = "", status=None):
|
||||
@@ -60,7 +63,10 @@ class Friction(SQLSubModel):
|
||||
@classmethod
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
reach = data["parent"] # Reach object
|
||||
|
||||
logger.info(data)
|
||||
|
||||
reach = data["reach"]
|
||||
status = data["status"]
|
||||
stricklers = data["stricklers"].stricklers
|
||||
|
||||
@@ -69,9 +75,6 @@ class Friction(SQLSubModel):
|
||||
f"FROM friction WHERE reach = {reach.id}"
|
||||
)
|
||||
|
||||
for _ in table:
|
||||
new.append(None)
|
||||
|
||||
for row in table:
|
||||
ind = row[0]
|
||||
# Get stricklers
|
||||
@@ -86,7 +89,11 @@ class Friction(SQLSubModel):
|
||||
sec.begin_strickler = bs
|
||||
sec.end_strickler = es
|
||||
|
||||
yield ind, sec
|
||||
new.append((ind, sec))
|
||||
|
||||
logger.info(new)
|
||||
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
ind = data["ind"]
|
||||
@@ -116,6 +123,10 @@ class Friction(SQLSubModel):
|
||||
def edge(self):
|
||||
return self._edge
|
||||
|
||||
@property
|
||||
def reach(self):
|
||||
return self._edge
|
||||
|
||||
@edge.setter
|
||||
def edge(self, edge):
|
||||
self._edge = edge
|
||||
|
||||
Reference in new issue
Block a user