Skip to content

Commit

Permalink
[web] Fix various bugs
Browse files Browse the repository at this point in the history
contains a hotfix for #654
  • Loading branch information
lukasjuhrich committed Aug 2, 2023
1 parent ad5d283 commit f51c1fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions web/blueprints/user/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
url_for,
session as flask_session,
make_response,
jsonify,
)
from flask_login import current_user
from markupsafe import Markup
Expand Down Expand Up @@ -576,10 +577,14 @@ def json_trafficdata(user_id, days=7):
"""
interval = timedelta(days=days)
utcnow = session.utcnow()
return [
e.__dict__
for e in traffic_history(user_id, utcnow - interval + timedelta(days=1), utcnow)
]
return jsonify(
[
e.__dict__
for e in traffic_history(
user_id, utcnow - interval + timedelta(days=1), utcnow
)
]
)


@bp.route('/create', methods=['GET', 'POST'])
Expand Down Expand Up @@ -1085,7 +1090,7 @@ def room_history_json(user_id):
ends_at=date_format(
history_entry.active_during.end, formatter=date_filter
),
room=T.room.value(
room=LinkColResponse(
href=url_for("facilities.room_show", room_id=history_entry.room_id),
title=history_entry.room.short_name,
),
Expand Down
4 changes: 2 additions & 2 deletions web/blueprints/user/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class MembershipRow(BaseModel):
ends_at: DateColResponse
actions: list[BtnColResponse]
# used by membershipRowAttributes
grants: list[str]
denies: list[str]
grants: list[str | None]
denies: list[str | None]
# used by membershipRowFormatter
active: bool

Expand Down

0 comments on commit f51c1fc

Please sign in to comment.