Skip to content

Commit

Permalink
fix sqlalchemy update errors for river_basins
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Corny committed Apr 9, 2024
1 parent 8cd4a12 commit d062c57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/gn_module_zh/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def get_main_rb(query: list) -> int:
area = 0
for q_ in query:
zh_polygon = (
DB.session.scalars(select(TZH.geom).where(TZH.id_zh == getattr(q_, "id_zh")))
DB.session.execute(select(TZH.geom).where(TZH.id_zh == getattr(q_, "id_zh")))
.first()
.geom
)
rb_polygon = (
DB.session.scalar(
DB.session.execute(
select(CorZhRb, TRiverBasin)
.join(TRiverBasin, TRiverBasin.id_rb == CorZhRb.id_rb)
.where(TRiverBasin.id_rb == getattr(q_, "id_rb"))
Expand Down
2 changes: 1 addition & 1 deletion backend/gn_module_zh/model/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ def __set_statuses(self):
return self.status.__str__()

def __set_hierarchy(self):
return self.hierarchy.__str__() if self.hierarchy is not None else None
return self.hierarchy.as_dict() if self.hierarchy is not None else None

def __set_evaluation(self):
self.__set_main_functions()
Expand Down
2 changes: 1 addition & 1 deletion backend/gn_module_zh/model/zh_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def get_id_types_ref_geo(id_zh, ref_geo_config):
@staticmethod
def get_ref_geo_info(id_zh, id_types):
return [
DB.session.scalars(
DB.session.execute(
select(CorZhArea, LAreas, TZH)
.join(LAreas)
.where(CorZhArea.id_zh == id_zh, LAreas.id_type == id_type, TZH.id_zh == id_zh)
Expand Down

0 comments on commit d062c57

Please sign in to comment.