-
Bug
-
Resolution: Fixed
-
Minor
-
4.1.2
-
MOODLE_401_STABLE
-
MOODLE_401_STABLE, MOODLE_402_STABLE
-
MDL-77912_401 -
If there are multichoice questions in the database with no answers (doesn't seem possible from the GUI, but we have a few from past semesters in our database), the recalculate scheduled task throws an exception because the value for randomguessscore is calculated as NAN (in question/type/multichoice/questiontype.php:252, denominator of count of answers is 0, division by 0 error). The exception causes the entire task to fail. Even though it is a remote possibility, should a check for dividing by 0 be included here to prevent the task from failing altogether?
Scheduled task failed: Recalculate question statistics (quiz_statistics\task\recalculate),Error writing to database (Unknown column 'NAN' in 'field list'
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 => '67a4aa3ea0c50feb5a90e36dec5271716c86ac33',
1 => 1681313612,
2 => '4715684',
3 => NULL,
4 => 1,
5 => 19,
6 => NULL,
7 => 0,
8 => NULL,
9 => NULL,
10 => 0.0,
11 => 0.0,
12 => '',
13 => '5.0000000',
14 => '3,4,7,9,10,11,12,14,15,16,19',
15 => NAN,
16 => NULL,
)]
Backtrace:
- line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
- line 1362 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
- line 1408 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 271 of /question/classes/statistics/questions/all_calculated_for_qubaid_condition.php: call to core_question\statistics\questions\calculated->cache()
- line 259 of /question/classes/statistics/questions/calculator.php: call to core_question\statistics\questions\all_calculated_for_qubaid_condition->cache()
- line 650 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\questions\calculator->calculate()
- line 937 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
- line 108 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
- line 259 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
- line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
- line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
- line 178 of /admin/cli/cron.php: call to cron_run()
Thanks!
- has a non-specific relationship to
-
MDL-76298 Drag drop questions don't validate that drop zones have been defined (causing division by zero errors in the statistics)
- Closed
-
MDL-77378 Cloze question where all subquestions have zero weight cause Division by zero errors
- Closed
- is blocked by
-
MDL-81976 \quiz_statistics\task\recalculate, Error writing to database - Unknown column 'INF' in 'field list'
- Open