-
Notifications
You must be signed in to change notification settings - Fork 146
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
517af89
b36e41e
6c9f948
bdfb350
582aba5
cc3e1b2
b4cf95c
8c1a755
4e1fcf5
7dcfa62
a2db34e
0b810cf
937acad
7852f2e
60301ad
a4475e0
0a33410
5f10109
6cc1cf4
87bbf6d
b198732
d5fa9c6
c9f3a0a
51b5f99
2f5711c
74e9076
1dc1fb7
36a5a00
01d60a2
03622d6
c526f84
810a957
2ab9cff
6715f77
351fbaa
08983c3
eebef2b
cd63d80
3db7709
32a4c79
3364e5c
0b863c6
58d239d
fc9a393
83754ea
6a7f0de
194e3cd
2a4553e
0efe340
876f619
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,7 @@ | |
elif user.is_active and user.can_be_marked_inactive_by_manager: | ||
users_to_mark_inactive.append(user) | ||
elif not user.is_active: | ||
inactive_users.append(user) | ||
|
||
messages.info( | ||
request, | ||
|
@@ -199,7 +199,7 @@ | |
messages.warning(request, message) | ||
for user in users_to_mark_inactive + inactive_users: | ||
for message in remove_inactive_participations(user, test_run): | ||
messages.warning(request, message) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is not covered by tests, because we only test the implementation of It would boil down to setting up a situation where a user is marked as inactive and checking that the message appears. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure whether you want me to implement this and if so, where can I find the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo, it's supposed to be bulk update ( |
||
if test_run: | ||
messages.info(request, _("No data was changed in this test run.")) | ||
else: | ||
|
@@ -396,9 +396,8 @@ | |
return [ | ||
_("{} will be removed from {} participation(s) due to inactivity.").format(user.full_name, evaluation_count) | ||
Redflashx12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
else: | ||
user.evaluations_participating_in.clear() | ||
return [_("Removed {} from {} participation(s) due to inactivity.").format(user.full_name, evaluation_count)] | ||
user.evaluations_participating_in.clear() | ||
return [_("Removed {} from {} participation(s) due to inactivity.").format(user.full_name, evaluation_count)] | ||
Redflashx12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
def user_edit_link(user_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.
The elif here seems suspicious to me. An inactive user that has
can_be_marked_inactive_by_manager == False
wouldn't end up ininactive_users
, and thus we wouldn't callremove_inactive_participations
. I don't know whether such a user can exist, but I'd prefer to not have to think about this.I think the loop here was meaningful and concise before, and just handled user deletion (or deactivation, if deletion isn't possible). I'd view removal of participations as orthogonal, and try to keep these as separate as possible, i.e., first just handle all deletion/marking inactive, and then handle participation archival on the remaining users. What do you think about 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 added that line because the requirement in the original issue #2176 mentioned that "long inactive users are users who are inactive (or can_be_marked_inactive_by_manager)", but I just checked the if condition and set a breakpoint and during the bulk update test nothing was ever added to that list, so it's probably unnecessary. Logically that would mean that the evaluations.count() > 0 and this and-statement of can_be_deleted_by_manageris is not true, otherwise they would be added to deletable_users :
self.participations_are_archived and self.grade_documents_are_deleted and self.results_are_archived
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 also asked Johannes and he mentioned it's also not necessary. So I just deleted those lines.