Skip to content

Commit

Permalink
Add backward compatibility for last_selected_payer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo144 committed Oct 1, 2023
1 parent bc7bc96 commit e0ef83d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ihatemoney/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,15 @@ def list_bills():
# Used for CSRF validation
csrf_form = EmptyForm()
# set the last selected payer as default choice if exists
if (
"last_selected_payer_per_project" in session
and g.project.id in session["last_selected_payer_per_project"]
):
bill_form.payer.data = session["last_selected_payer_per_project"][g.project.id]
if "last_selected_payer_per_project" in session:
if g.project.id in session["last_selected_payer_per_project"]:
bill_form.payer.data = session["last_selected_payer_per_project"][
g.project.id
]
# for backward compatibility, should be removed at some point
else:
if "last_selected_payer" in session:
bill_form.payer.data = session["last_selected_payer"]

# Each item will be a (weight_sum, Bill) tuple.
# TODO: improve this awkward result using column_property:
Expand Down

0 comments on commit e0ef83d

Please sign in to comment.