(Canvas Data 2) Submissions without Enrollment still having a workflow_state that is not 'deleted’.

Givan
Community Explorer

Hey Community,

I am currently working on a synchronisation of my own database, in which I make use of Canvas Data 2.
Right now I am fetching their data, mapping their models to my models and filling my database with it. This is currently a migration of a previous implementation that runs with the old Canvas LMS Rest API.

Now their is an issue that came to mind: When I was migrating, I noticed I fetched more rows than the Canvas LMS Rest API, after the I ran the same filter on them. After uttermost effort looking into the entire file that i was receiving I noticed an issue with the current use of the workflow_state on my submission. I am filtering out the submissions with 'workflow_state': 'deleted' and noticed that there are still submissions with a normal workflow_state like 'unsubmitted' eventhough the user does not have an enrollment to the course anymore.

I went and looking into the code and found that my way of thinking was probably correct, because they are supposed to set the submission state to 'deleted' when the enrollment is deleted.

Code I found:
# Get any stragglers that might have had their enrollment removed from the course
# 100 students at a time for 10 assignments each == slice of up to 1K submissions
enrollment_counts.deleted_student_ids.each_slice(100) do |student_slice|
@assignment_ids.each_slice(10) do |assignment_ids_slice|
Submission.active .where(assignment_id: assignment_ids_slice, user_id: student_slice) .update_all(workflow_state: :deleted, updated_at: Time.zone.now) end User.clear_cache_keys(student_slice, :submissions)
end

To give some more context:
Submission: user_id: 1, course_id: 20, assignment_id: 300, workflow_state: 'unsubmitted'
User: id: 1 is present
Course: id: 20, is present
Assignment: Id: 300 is present
Enrollment with user and course has workflow_state: "deleted"

Does anyone have any idea if I'm in the wrong or is this an issue that has to be addressed to Canvas Data 2?

0 Likes