Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix asset display when asset has no owner #514

Merged
merged 2 commits into from Oct 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions flexmeasures/data/services/sensors.py
@@ -1,4 +1,5 @@
from __future__ import annotations
from typing import Optional
nhoening marked this conversation as resolved.
Show resolved Hide resolved

import sqlalchemy as sa

Expand All @@ -7,7 +8,7 @@


def get_sensors(
account: Account | list[Account],
account: Optional[Account | list[Account]],
include_public_assets: bool = False,
sensor_id_allowlist: list[int] | None = None,
sensor_name_allowlist: list[str] | None = None,
Expand All @@ -20,7 +21,9 @@ def get_sensors(
:param sensor_name_allowlist: optionally, allow only sensors whose name is in this list
"""
sensor_query = Sensor.query
if isinstance(account, list):
if account is None:
account_ids = []
elif isinstance(account, list):
account_ids = [account.id for account in account]
else:
account_ids = [account.id]
Expand Down