buggyrace / buggy-race-server

Race server and supporting material for running a "Buggy Racing" Python programming project
https://www.buggyrace.net
Other
1 stars 0 forks source link

cannot bulk upload tasks if any student task texts already exist #213

Closed davewhiteland closed 5 months ago

davewhiteland commented 6 months ago

When admin uploads all the tasks (markdown upload), the first thing the server does is delete all the existing tasks — but this fails with a foreign key violation if there are any student task texts in the database for tasks that would be deleted. The remedy is to make that a cascade delete — simple ;-)

But... that's also worthy of a big red warning "There are student task texts in the database! These will be deleted if you do this! Are you properly sure?" The only issue here is that currently admins cannot delete (or edit) students' task texts, so this is somewhat powerful and needs clear signposting.

This is a fairly exceptional situation, because normally there should not be any student texts if you are still setting up the tasks.

image

davewhiteland commented 6 months ago

There's currently an extra nasty in this, in that if the texts are associated with a non-student account (e.g., a staff account because someone was testing the text feature, which is fine), then those texts are not shown (because the /admin/task-texts page never shows texts for non-active students) then it can be hard to spot what's wrong.

Might need to add a Troubleshooting point for this:

Q: How come I can't see my texts?

A: You can. But if you're not an enrolled student your texts won't show up on the main text matrix/screen, but you can access them via your own Settings page.