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

Delete participations of long inactive users #2329

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
517af89
Add PARTICIPATION_DELETION_AFTER_INACTIVE_MONTHS to settings.py with …
Redflashx12 Oct 21, 2024
b36e41e
Add bulk delete of inactive users from their evaluations
Redflashx12 Oct 21, 2024
6c9f948
Update to use timedelta and just mentioning months instead of convert…
Redflashx12 Oct 21, 2024
bdfb350
Filter users which do not have any evaluations in which they are inac…
Redflashx12 Oct 21, 2024
582aba5
change unit to days since months is not supported and add small comment
Redflashx12 Oct 21, 2024
cc3e1b2
fix typo
Redflashx12 Oct 21, 2024
b4cf95c
fix correct date subtraction
Redflashx12 Oct 21, 2024
8c1a755
Add default value for test_run
Redflashx12 Oct 21, 2024
4e1fcf5
WIP test for inactivity
Redflashx12 Oct 21, 2024
7dcfa62
Refactor functionality to dedicated function
Redflashx12 Nov 4, 2024
a2db34e
Fix test by archiving the semester and using settings value in test f…
Redflashx12 Nov 4, 2024
0b810cf
Remove unneeded +1 and brackets, add evaluation needed to not be mark…
Redflashx12 Nov 4, 2024
937acad
refactor and split into two tests
Redflashx12 Nov 4, 2024
7852f2e
Fix indentation
Redflashx12 Nov 4, 2024
60301ad
Forgot to remove factor 30 for months since it's already included, ne…
Redflashx12 Nov 4, 2024
a4475e0
black formatting
Redflashx12 Nov 4, 2024
0a33410
isort formatting
Redflashx12 Nov 4, 2024
5f10109
increase test coverage by adding test case for test run
Redflashx12 Nov 4, 2024
6cc1cf4
Fix django import of settings
Redflashx12 Nov 11, 2024
87bbf6d
fix to use pythonic way of checking len
Redflashx12 Nov 11, 2024
b198732
Use timedelta instead of numeric value for days
Redflashx12 Nov 11, 2024
d5fa9c6
Fix logic
Redflashx12 Nov 11, 2024
c9f3a0a
Add inactive users to be removed
Redflashx12 Nov 11, 2024
51b5f99
Change django magic query to look and check latest vote_end_date
Redflashx12 Nov 11, 2024
2f5711c
Refactor test to use django's setUpTestData
Redflashx12 Nov 11, 2024
74e9076
"Fix" type hint to use | None instead of Optional
Redflashx12 Nov 11, 2024
1dc1fb7
reorder imports
Redflashx12 Nov 11, 2024
36a5a00
linting
Redflashx12 Nov 11, 2024
01d60a2
Add more edge cases to tests
Redflashx12 Nov 11, 2024
03622d6
Remove assignment of never used variable
Redflashx12 Nov 11, 2024
c526f84
Merge branch 'main' into main
Redflashx12 Nov 11, 2024
810a957
refactor `remove_inactive_participations`
niklasmohrin Nov 18, 2024
2ab9cff
Rename variable
Redflashx12 Nov 18, 2024
6715f77
Implement feedback
Redflashx12 Nov 18, 2024
351fbaa
Fix logic error and wrong type
Redflashx12 Nov 18, 2024
08983c3
Fix missing rename of variable in @override_settings
Redflashx12 Nov 18, 2024
eebef2b
Extend to test for user.evaluations_participating_in.exists() and rep…
Redflashx12 Nov 18, 2024
cd63d80
Use mock.patch decorator instead of creating new Evaluations with use…
Redflashx12 Nov 18, 2024
3db7709
Remove unused import
Redflashx12 Nov 18, 2024
32a4c79
ruff fix
Redflashx12 Nov 18, 2024
3364e5c
Use proper plural formatting
Redflashx12 Jan 6, 2025
0b863c6
Use proper plural formatting
Redflashx12 Jan 6, 2025
58d239d
Fix missing import of ngettext
Redflashx12 Jan 6, 2025
fc9a393
Update assert in tests to use the new phrasing
Redflashx12 Jan 20, 2025
83754ea
Implement feedback from Richard
Redflashx12 Jan 20, 2025
6a7f0de
Remove last elif check which is unnecessary
Redflashx12 Jan 20, 2025
194e3cd
lint
Redflashx12 Jan 20, 2025
2a4553e
format
Redflashx12 Jan 20, 2025
0efe340
Implement feedback: more explicit test and renamed function
Redflashx12 Jan 27, 2025
876f619
Fix wrong rename
Redflashx12 Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix typo
Redflashx12 committed Oct 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit cc3e1b233ac7b361424fef858bf61abf8601e5e7
4 changes: 2 additions & 2 deletions evap/staff/tools.py
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ def bulk_update_users(request, user_file_content, test_run): # noqa: PLR0912
messages.warning(request, message)
for user, evaluations in inactive_users_participation:
if len(evaluations) > 0:
for message in remove_inactivate_participations(user, evaluations, test_run):
for message in remove_inactive_participations(user, evaluations, test_run):
messages.warning(request, message)
if test_run:
messages.info(request, _("No data was changed in this test run."))
@@ -383,7 +383,7 @@ def remove_user_from_represented_and_ccing_users(user, ignored_users=None, test_
return remove_messages


def remove_inactivate_participations(user, evaluations, test_run):
def remove_inactive_participations(user, evaluations, test_run):
remove_messages = []
if test_run:
remove_messages.append(