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

Bugfix #1080: "Deactivated users reappeared" #1104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chestnutFan
Copy link

@chestnutFan chestnutFan commented Dec 10, 2022

Fixed #1080 by adding the deactivated member check. Corresponding test functions were also finished.

Details:
1. Added the deactivated member check for editing/deleting bills.
Compare the payer&owers list (POL) of the bill with the active member list (AML). If the relative complement of AML in POL (POL \ AML) is not empty, then the bill contains deactivated members and should not be edited/deleted.
2. Added two corresponding integration test functions.

Test:
Passed all the tests.

@chestnutFan chestnutFan changed the title Adding the deactivated user check and corresponding test functions Bugfix #1080: "Deactivated users reappeared" Dec 11, 2022
Copy link
Member

@almet almet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this. It's leading the right way, but needs some changes before integration.

Some feedback :

  1. At all times, avoid copy-pasting code. Here the code to get the deactivated member list is in two different places. If we needed this code, it should probably go in the model instead ;
  2. I believe we don't actually need this code because the model can already tel us what are the deactivated members. Try to do this instead of building the list on your own
  3. In terms of UX, I believe it would be better to have a tooltip as I explained. I'm happy to change my mind on this if you have good arguments :-)

Anyway, thanks for taking the time to do this 👍. Let me know when you've made some edits.

ihatemoney/web.py Outdated Show resolved Hide resolved
ihatemoney/web.py Outdated Show resolved Hide resolved
@chestnutFan
Copy link
Author

Hi Almet! Thanks for reviewing my code. I rewrote the check function using the activated attribute, and moved it to the model.

@chestnutFan
Copy link
Author

chestnutFan commented Dec 13, 2022

Hi @almet! Tooltips have been added.

This is also true for deletion. Once a user is deactivated, all the
related bills shouldn't be able to move.
@almet
Copy link
Member

almet commented Jan 5, 2025

This is a bit old now, but I wanted to continue working on it, as I'm currently in the process of tidying a bit this repository.

I've rebased this on top of the latest main branch, and it can be merged. But... I'm actually starting to think we're fixing something that is not a problem: if you delete or edit a bill that was involving a deactivated user, I believe we should make it reappear, since its balance is now changed.

Making it so that it's not possible doesn't actually seem right to me, as there are cases where we want to actually change this, for instance if a mistake was made.

So, I'm planning on closing this and #1080 at the same time, unless somebody points me why we should do this.

Cheers!

@chestnutFan
Copy link
Author

This is a bit old now, but I wanted to continue working on it, as I'm currently in the process of tidying a bit this repository.

I've rebased this on top of the latest main branch, and it can be merged. But... I'm actually starting to think we're fixing something that is not a problem: if you delete or edit a bill that was involving a deactivated user, I believe we should make it reappear, since its balance is now changed.

Making it so that it's not possible doesn't actually seem right to me, as there are cases where we want to actually change this, for instance if a mistake was made.

So, I'm planning on closing this and #1080 at the same time, unless somebody points me why we should do this.

Cheers!

Sounds reasonable to me. Glad to see this one finally been nailed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deactivated users reappeared
2 participants