Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69771

mod_quiz: Attempts with Drag and drop onto image breaks Results / Statistics page

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.8.5, 4.0
    • None
    • Questions, Quiz
    • None
    • MOODLE_38_STABLE, MOODLE_400_STABLE

    Description

      The Quiz Results Statistics page is broken if there is an attempt that uses Drag and Drop Onto Image question.

      Environment:
      Moodle: 2021052500.14 | 4.0dev (Build: 20200918)
      Database: mysql-server-5.7.31-0 amd64

      Steps:
      1. Create a course and enrol a student.
      2. Turn editing on.
      3. Add a Quiz activity.
      4. Edit the quiz and add a question:

      • Question type: Drag and drop onto image
      • Name: My D&D onto image question
      • Question text: The engineer is preparing to draw the plan. What are the steps (in order) that needs to be completed?
      • Upload a background image: Any image type.
      • Shuffle drag items each time question is attempted: Ticked
      • Draggable item 1, type: Draggable text, text: Gather the necessary materials
      • Draggable item 2, type: Draggable text, text: Get previous sketches
      • Multiple tries, Penalty for each incorrect try: 100%

      5. As a student log in and attempt the quiz.
      6. Do not answer the question, just click Finish attempt... and click Submit all and finish.
      7. As teacher/admin go to the Quiz activity. Click Results / Statistics.
      OUTPUT:

      Warning: Division by zero in /var/www/html/vanilla/question/type/ddimageortext/questionbase.php on line 152
       
      Warning: Division by zero in /var/www/html/vanilla/question/type/ddimageortext/questionbase.php on line 152
      Error writing to database
       
      More information about this error
      Debug info: Unknown column 'NAN' in 'field list'
      INSERT INTO mdl_question_statistics (hashcode,timemodified,questionid,slot,subquestion,s,effectiveweight,negcovar,discriminationindex,discriminativeefficiency,sd,facility,subquestions,maxmark,positions,randomguessscore,variant) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => '1afcbec028f7ca4b759200c2b2aa39303f30bdba',
      1 => 1600822611,
      2 => '1',
      3 => 1,
      4 => 0,
      5 => 2,
      6 => NULL,
      7 => 0,
      8 => NULL,
      9 => NULL,
      10 => 0.0,
      11 => 0.0,
      12 => '',
      13 => '1.0000000',
      14 => 1,
      15 => NAN,
      16 => NULL,
      )]
      Error code: dmlwriteexception 
      Stack trace:
       
          line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
          line 1357 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
          line 1403 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
          line 231 of /question/classes/statistics/questions/calculated.php: call to mysqli_native_moodle_database->insert_record()
          line 259 of /question/classes/statistics/questions/all_calculated_for_qubaid_condition.php: call to core_question\statistics\questions\calculated->cache()
          line 258 of /question/classes/statistics/questions/calculator.php: call to core_question\statistics\questions\all_calculated_for_qubaid_condition->cache()
          line 645 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\questions\calculator->calculate()
          line 153 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
          line 97 of /mod/quiz/report.php: call to quiz_statistics_report->display()
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jebarvia Joshua Ebarvia
              Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: