Skip to content

Commit

Permalink
fix: delete_one_zh_notes called in backend directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Corny committed Jan 9, 2025
1 parent a1e38dc commit e746b3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions backend/gn_module_zh/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ def generate_all_notes():
result = DB.session.scalars(select(TZH.id_zh)).all()
if result:
for id_zh in result:
# print(id_zh)
try:
get_hierarchy(id_zh)
except Exception as e:
Expand Down Expand Up @@ -1028,9 +1029,14 @@ def get_hierarchy(id_zh):
"""Get zh note"""
main_id_rb = DB.session.scalar(select(TZH.main_id_rb).where(TZH.id_zh == id_zh))
if not main_id_rb:
delete_one_zh_notes(id_zh)
raise NotFound("The ZH is not in a river basin")
hierarchy = Hierarchy(id_zh, main_id_rb)
return hierarchy.as_dict()
try:
hierarchy = Hierarchy(id_zh, main_id_rb)
return hierarchy.as_dict()
except Exception as e:
delete_one_zh_notes(id_zh)
raise ZHApiError(message=str(e.message), details=str(e.details))


@blueprint.route("/hierarchy/fields/<int:id_rb>", methods=["GET"])
Expand Down
1 change: 0 additions & 1 deletion frontend/app/services/hierarchy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class HierarchyService {
(i) => error.error['message'] === i.api
)[0].front;
}
this.deleteNotes(zhId);
},
() => {
this.isLoading = false;
Expand Down

0 comments on commit e746b3c

Please sign in to comment.