mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-14204 "Content for Quiz Statistics report table - Random_guess_score" added method random_guess_score to question type objects and a new function in questionlib that calls the question type method.
This commit is contained in:
parent
ed48af75b4
commit
6f51ed72be
12 changed files with 201 additions and 96 deletions
|
@ -272,7 +272,20 @@ class question_randomsamatch_qtype extends question_match_qtype {
|
|||
$result->responses = $answers;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $question
|
||||
* @return integer a score out of 1 that the average random guess by a
|
||||
* student might give.
|
||||
*/
|
||||
function get_random_guess_score($question) {
|
||||
//Effectively $subquestions multi choice questions with equal weighting
|
||||
//assuming a student has the intelligence to not select the same answer twice
|
||||
//there is in each subquestion factorial($subquestions-1) chance of getting
|
||||
//the answer right. There are factorial($subquestions) possible combinations of
|
||||
//answers and it works out to an average grade of 1/$subquestions.
|
||||
$subquestions = count($question->options->subquestions);
|
||||
return 1/$subquestions;
|
||||
}
|
||||
/// BACKUP FUNCTIONS ////////////////////////////
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue