Skip to content

Commit

Permalink
Stop assuming sort_by is already in session
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Jul 5, 2024
1 parent 428aef4 commit 3df69ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/howitz/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def get_current_events():


def get_sorted_table_event_list(events: dict):
events_sorted = sort_events(events, sort_by=EventSort(session["sort_by"]))
events_sorted = sort_events(events, sort_by=EventSort(session.get("sort_by") or "raw"))
table_events = []
for c in events_sorted.values():
table_events.append(create_table_event(c, expanded=str(c.id) in session["expanded_events"],
Expand Down Expand Up @@ -864,8 +864,10 @@ def change_events_order():
return response

elif request.method == 'GET':
return render_template('/components/popups/modals/forms/sort-table-form.html', sort_methods=EventSort,
current_sort=EventSort(session["sort_by"]))
return render_template(
'/components/popups/modals/forms/sort-table-form.html', sort_methods=EventSort,
current_sort=EventSort(session.get("sort_by") or "raw")
)


@main.route('/navbar/show-user-menu', methods=["GET"])
Expand Down

0 comments on commit 3df69ef

Please sign in to comment.