I want to delete all courses that have not been accessed in 6 months.
How can I view a batch of courses based on last access date?
Thanks - Alice
Hi there, Alice Garrard!
I'm going to share this with both Canvas Admins and Canvas Developers to see if there's a creative way to accomplish this. Hopefully the extra sets of eyes will help provide you an answer!
I would use Canvas Data. It contains an enrollment_dim table that has a field called last_activity_at.
You're probably not using MySQL so this statement may need modified a little, but here's a little snippet to return those courses that have not been accessed in more than 6 months.
SELECT c.canvas_id, c.name, MAX(e.last_activity_at) AS last_activityFROM course_dim c JOIN enrollment_dim e ON (e.course_id = c.id)GROUP BY c.canvas_id , c.nameHAVING last_activity < NOW() - INTERVAL 6 MONTH;
You can pull in other values that you might want. You can also filter by the type of enrollment if you need to check access by just instructors or just students. For example, you could add a WHERE type='StudentEnrollment' before the GROUP BY statement to look at just students. You would also probably want to double check the courses against a list of "Never Delete" courses as a safety net.
If you don't use Canvas Data, you can use the API to query every enrollment in every course, which takes a lot of time. It would be faster to just check for instructor access, but it's a few seconds in Canvas Data (once it's set up) vs minutes to hours through the API depending on how many courses you have and who you want to check.
It would be nice if the enrollments portion of the Provisioning report from the Admin > Settings > Reports menu gave the information, but it doesn't contain the last_activity, just a bunch of other information needed to re-create an enrollment. There's also the promising "Last enrollment activity", but only gives the last access by the user, not the last activity by the enrollment, so it doesn't contain the course information that you would need.
I thought I would follow up. James has provided some great insights and a sound solution. Has this answered your original question and got you up and running?
Hello there, Alice Garrard...
I have been reviewing older questions here in the Canvas Community, and I stumbled upon your question. I wanted to check in with you because I noticed that we've not heard back from you since you first posted this question on January 10, 2018. It looks like James Jones provided you with some great feedback here, and also Stuart Ryan tried checking in with you on February 24, 2018. Have you had a chance to review all the above postings from Community members (especially the one from James)? If so, did any of them help to answer your question? Do you have any outstanding questions as it relates to your initial question? If you feel that one of the above responses has helped to answer your question, please go ahead and mark it as "Correct". However, if you are still looking for some help from members of the Community, please come back to this thread to post an update below. For now, I am going to mark your question as "Assumed Answered" because we've not heard back from you and because there hasn't been any new activity in this topic for almost four months. However, that won't prevent you or others from posting additional questions and/or comments below that are related to this topic. I hope that's alright with you, Alice. Looking forward to hearing back from you soon!
Retrieving data ...