lifterlms icon indicating copy to clipboard operation
lifterlms copied to clipboard

[Quiz] Deleting a quiz questions causes issues when grading / reviewing quiz attempts

Open thomasplevy opened this issue 5 years ago • 2 comments

Reproduction Steps

  • Create and publish a quiz
  • Take the quiz as a student to create a quiz attempt (you can do this as the course creator/instructor)
  • Delete one or more questions from the published quiz
  • Review the quiz attempt as an admin & attempt to grade it or leave remarks

Expected Behavior

  • The quiz should display information about the deleted question despite it being deleted

Actual Behavior

  • The deleted question is not visibly displayed on the attempt grade
  • An error is encountered when saving the grade (see below)
  • The quiz still counts the deleted question for points, number of questions, and grading purposes
  • The widgets on the quiz attempt page display this quiz in counts, grades, points, etc...

Error Messages / Logs

  • Include any relevant error messages or log files
**[26-Apr-2019 18:16:39 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_auto_grade_type() on null in /srv/www/llms-72/public_html/wp-content/plugins/lifterlms/includes/models/model.llms.quiz.attempt.question.php:250
Stack trace:
#0 /srv/www/llms-72/public_html/wp-content/plugins/lifterlms/includes/models/model.llms.quiz.attempt.php(553): LLMS_Quiz_Attempt_Question->get_status()
#1 /srv/www/llms-72/public_html/wp-content/plugins/lifterlms/includes/models/model.llms.quiz.attempt.php(122): LLMS_Quiz_Attempt->is_auto_gradeable()
#2 /srv/www/llms-72/public_html/wp-content/plugins/lifterlms/includes/controllers/class.llms.controller.admin.quiz.attempts.php(103): LLMS_Quiz_Attempt->calculate_grade()
#3 /srv/www/llms-72/public_html/wp-content/plugins/lifterlms/includes/controllers/class.llms.controller.admin.quiz.attempts.php(61): LLMS_Controller_Admin_Quiz_Attempts->save_grade(Object(LLMS_Quiz_Attempt))
#4 /srv/www/llms-72/public_html/wp-includes/class-wp-hook.php(286): LLMS_Controller_Admin_Quiz_Attempts->maybe_run_actions('')
#5 /srv/www/l in /srv/www/llms-72/public_html/wp-content/plugins/lifterlms/includes/models/model.llms.quiz.attempt.question.php on line 250
**

Possible Solutions

  • When a question is deleted from a quiz LifterLMS should determine if the question exists in any existing attempts. If it does, the question should be archived instead of deleted.
  • This could be a new custom post status reserved for this post type.
  • An archived question should be excluded from all quiz related queries EXCEPT with relation to quiz attempts
  • When an attempt is deleted all archived questions should be checked to see if that archived question can now safely be deleted
  • An interface on the admin review may need to display that the question is an archived question (?)

thomasplevy avatar Apr 26 '19 18:04 thomasplevy

It is a difficult one because there is no option to manually correct the issue, except by editing serialized attempt information directly into the database.

Possible Solutions

On Attempt Screen (Manual Grading):

  1. Orphaned answers show a warning (question doesn't exist).
  2. An option to delete orphaned question's answers.
  3. An option to manually grade answers whose questions don't exist.
  4. An option to manually grade answers that don't exist because their questions were added after the attempt.
  5. Ignore such answers from the grading calculations, or present a conflict resolution UI of some sorts.

On Builder

Add a warning in the builder when a question in a quiz (with existing attempts) is modified/deleted or when new ones are added.

actual-saurabh avatar Feb 10 '20 14:02 actual-saurabh

HS-117320 (this isn't a bump I just had this attached to the wrong issue)

nrherron92 avatar Mar 18 '21 15:03 nrherron92