Commit Graph

1 Commits

Author SHA1 Message Date
Jeremy Stanley 9d84294a08 avoid recalculating enrollment states due to truncation
if SIS CSV sets course or section dates with more than 6 digits
of precision, the sub-microsecond part will be truncated by
the database.

when a subsequent SIS import runs and includes the same
timestamp in the CSV as before, ActiveRecord compares the
value in the database to the one set from the CSV and
concludes the timestamp has changed by a fraction of a
microsecond. if the course restricts student activity to
course dates, this will cause enrollment states to be
recalculated. with a large import, this may clog up the
job servers with tens of thousands of unnecessary jobs.

update the logic so we don't recalculate enrollment states
for course or section date changes under one second

test plan:
 - set up a course with restrict_enrollments_to_course_dates
 - change its conclude_at date by more than a second
   and ensure enrollment states are recalculated
 - change its conclude_at date by less than a second
   and ensure enrollment states are not recalculated

flag=none
fixes FOO-3511

Change-Id: I1b668e1654574b6bc964989ff25715fd1aa71607
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/318095
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-05-16 19:36:36 +00:00