Skip to content

Commit

Permalink
Fix the removed counts in SIS logging
Browse files Browse the repository at this point in the history
SIS logging incorrectly counted earlier removed students as removed
on every updated. Now it counts only those participants who were not
removed earlier.
  • Loading branch information
PasiSa authored and markkuriekkinen committed May 30, 2023
1 parent ae4315c commit 1998a0e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions course/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,11 +964,13 @@ def enroll_from_sis(self) -> Tuple[int, int]:
# unenrolled themselves.
students = self.all_students.filter(enrollment__from_sis=True)
to_remove = students.exclude(student_id__in=participants)
qs = Enrollment.objects.filter(user_profile__in=to_remove, course_instance=self)
qs.update(status=Enrollment.ENROLLMENT_STATUS.REMOVED)
qs = (Enrollment.objects
.filter(user_profile__in=to_remove, course_instance=self)
.exclude(status=Enrollment.ENROLLMENT_STATUS.REMOVED)
)
for e in qs:
invalidate_content(Enrollment, e)
delcount += 1
delcount = qs.update(status=Enrollment.ENROLLMENT_STATUS.REMOVED)
else:
logger.warning("%s: Received an empty participants list from SIS.", self)
return 0, 0
Expand Down

0 comments on commit 1998a0e

Please sign in to comment.