-
Notifications
You must be signed in to change notification settings - Fork 271
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
Default owers when adding a bill #1222
Conversation
ihatemoney/web.py
Outdated
bill_form.payer.data = session["last_selected_payer"] | ||
if g.project.id in session["last_selected_payer"]: | ||
bill_form.payer.data = session["last_selected_payer"][g.project.id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for Flask experts:
When does the session expires? I changed the representation of session["last_selected_payer"]
, does the session automatically expires during an update of IHM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the session is kept even when you update IHM, so you always need to account for the old format and convert it. This has been a frequent source of heisenbugs in the past.
In general, can you separate the two changes into separate commits/PR? One which adds the new "payed_for", and one which fixes the behaviour of payer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, can you separate the two changes into separate commits/PR?
I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the PR. The bug fix is now in #1224 and the new feature in this PR.
I like the idea, and the "simple" approach with the session looks good to me. As said above, please separate the new feature and the fix. You can look at adding a test (including for the fix, to avoid a regression). You can find a similar test here I believe: test_session_projects_migration_to_list |
59a9f66
to
5ec056d
Compare
Woah, all tests fail with this error: This looks totally unrelated to your change... Can you try to rebase? |
fb6f1fe
to
82d9ecc
Compare
Sorry, you need to rebase because of the tests re-organisation + the flask-wtf fix |
82d9ecc
to
89f9e6f
Compare
Can you fix the conflict? |
89f9e6f
to
ac3a4e5
Compare
Perfect, thanks. |
* Remember last owers for next new bill * Add a test for last_selected_payed_for
English
In short. Would you find nice to:
?
(This PR implements 1.)
Français
J'utilise régulièrement IHM dans un projet où je sélectionne toujours les mêmes "Pour qui ?" quand je saisi une facture. C'est un peu long de désélectionner à chaque fois.
Est-ce que vous seriez intéressés par une des propositions suivantes :
?
Ma préférence va à 1 (interface plus légère). Et vous ?
(Cette PR implémente 1.)