learningequality / kolibri

Kolibri Learning Platform: the offline app for universal education
https://learningequality.org/kolibri/
MIT License
809 stars 683 forks source link

Unable to delete a Quiz in case where the resource(s) inside don't exist // case of disappearing and reappearing content in a Quiz #12388

Open lauradanforth opened 4 months ago

lauradanforth commented 4 months ago

This was on kolibri-demo on 0.16.2:

Observed behavior

While logged in as an admin, in the Plan tab I noticed that one of my quizzes had content in it that no longer existed in the platform, so I tried to delete the Quiz. I got this pop up:

image

But when trying to click the 'Delete' button, nothing happened.

When I refreshed the page, the Quiz was still there but I also noticed that the content had been restored:

image

Context

Tell us about your environment, including:

pcenov commented 4 months ago

Hmm I tested this locally on Kolibri 0.16.2 and deleting a quiz with or without resources is working correctly so this must be some strange edge case:

https://github.com/learningequality/kolibri/assets/79847249/e59921c3-f4d8-4798-bc9a-c0423d0ed0da

https://github.com/learningequality/kolibri/assets/79847249/ccfc56f6-6e24-4a08-bbf5-099fe33fed4f

nucleogenesis commented 4 months ago

Alrighty just adding that I've also not been able to replicate the error noted here on develop either.

I think that this Sentry error is related which suggests that this is a bug on the front-end.

I think that this is very much an edge case and that we can lower the priority on this one.

IMO next steps here are to just look at the quiz deletion machinery again to work out if there is a way for the quiz's ID value to be nulled that we can stop.

AlexVelezLl commented 4 months ago

I managed to replicate this, and yes, it is actually a very edge case. It happened because the server responded a 502 error on GET /api/exams/exam/size/, and for that reason, the frontend detects as it lost the connection with the server and doesnt load the data of the exam and resources, so thats why it says that resource is missing. And when you click on delete, we dont have the exam id, and thats why the delete button doesnt work.

Then, after reloading the page the server is already working ok and doesnt return the 502 error and thats why we can see the resources again.

So this error si more of why the server was unavailable and the gateway returned a 502, and why the frontend didnt show the "trying to reconnect" backdrop.

rtibbles commented 3 months ago

I think the answer here is just better error handling on the size calculation and optimization of the size calculation endpoints.