mterwill / office-hours-help-queue

A queue to help manage office hours for large courses
GNU General Public License v3.0
84 stars 21 forks source link

Uploading new course groups while there are in-flight requests breaks queue with 'not found' error #199

Open mterwill opened 3 years ago

mterwill commented 3 years ago

When new course groups are uploaded, we wipe out any existing groups and create all new ones:

https://github.com/mterwill/office-hours-help-queue/blob/c4eb3ca54da746ded55ee8cd5c83e6aa21815eb1/app/controllers/admin/courses_controller.rb#L58-L84

If this is done mid-semester with active requests, since we denormalize course_group_id onto the request at submit time, any existing course group IDs become invalid. We're not using foreign keys in our schema (I'm not sure why) so this ends up propagating up to a runtime error when we try to resolve groups for open requests: Couldn't find CourseGroup with 'id'.

mterwill commented 3 years ago

ad-hoc fix with

mysql> update course_queue_entries set course_group_id = NULL where course_queue_id = 753 and resolved_at is null;
Query OK, 13 rows affected (0.05 sec)
Rows matched: 13  Changed: 13  Warnings: 0