Skip to content

Commit

Permalink
Merge 10e3601 into e15b67b
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarcia98 committed Feb 29, 2024
2 parents e15b67b + 10e3601 commit bdbd331
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flexmeasures/ui/utils/breadcrumb_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from sqlalchemy import select
from flexmeasures import Sensor, Asset, Account
from flexmeasures.utils.flexmeasures_inflection import human_sorted
from flask import url_for
from flask import url_for, current_app


def get_breadcrumb_info(entity: Sensor | Asset | Account | None) -> dict:
Expand Down Expand Up @@ -73,7 +74,11 @@ def get_siblings(entity: Sensor | Asset | Account | None) -> list[dict]:
if entity.parent_asset is not None:
sibling_assets = entity.parent_asset.child_assets
else:
sibling_assets = entity.owner.generic_assets
session = current_app.db.session
sibling_assets = session.scalars(
select(Asset).where(Asset.owner is None)
).all()

siblings = [
{
"url": url_for("AssetCrudUI:get", id=asset.id),
Expand Down

0 comments on commit bdbd331

Please sign in to comment.