Merge branch 'MDL-43369-25' of git://github.com/jamiepratt/moodle into MOODLE_25_STABLE
This commit is contained in:
@@ -36,8 +36,6 @@ class quiz_statistics_question_stats {
|
||||
public $questions;
|
||||
public $subquestions = array();
|
||||
|
||||
protected $s;
|
||||
protected $summarksavg;
|
||||
protected $allattempts;
|
||||
|
||||
/** @var mixed states from which to calculate stats - iteratable. */
|
||||
@@ -49,12 +47,8 @@ class quiz_statistics_question_stats {
|
||||
/**
|
||||
* Constructor.
|
||||
* @param $questions the questions.
|
||||
* @param $s the number of attempts included in the stats.
|
||||
* @param $summarksavg the average attempt summarks.
|
||||
*/
|
||||
public function __construct($questions, $s, $summarksavg) {
|
||||
$this->s = $s;
|
||||
$this->summarksavg = $summarksavg;
|
||||
public function __construct($questions) {
|
||||
|
||||
foreach ($questions as $slot => $question) {
|
||||
$question->_stats = $this->make_blank_question_stats();
|
||||
@@ -74,6 +68,7 @@ class quiz_statistics_question_stats {
|
||||
$stats->s = 0;
|
||||
$stats->totalmarks = 0;
|
||||
$stats->totalothermarks = 0;
|
||||
$stats->totalsumgrades = 0;
|
||||
$stats->markvariancesum = 0;
|
||||
$stats->othermarkvariancesum = 0;
|
||||
$stats->covariancesum = 0;
|
||||
@@ -285,6 +280,7 @@ class quiz_statistics_question_stats {
|
||||
protected function initial_steps_walker($step, $stats, $positionstat = true) {
|
||||
$stats->s++;
|
||||
$stats->totalmarks += $step->mark;
|
||||
$stats->totalsumgrades += $step->sumgrades;
|
||||
$stats->markarray[] = $step->mark;
|
||||
|
||||
if ($positionstat) {
|
||||
@@ -313,6 +309,7 @@ class quiz_statistics_question_stats {
|
||||
}
|
||||
|
||||
$stats->othermarkaverage = $stats->totalothermarks / $stats->s;
|
||||
$stats->sumgradeaverage = $stats->totalsumgrades / $stats->s;
|
||||
|
||||
sort($stats->markarray, SORT_NUMERIC);
|
||||
sort($stats->othermarksarray, SORT_NUMERIC);
|
||||
@@ -334,7 +331,7 @@ class quiz_statistics_question_stats {
|
||||
$othermarkdifference = $step->sumgrades - $step->mark -
|
||||
$stats->othermarkaverage;
|
||||
}
|
||||
$overallmarkdifference = $step->sumgrades - $this->summarksavg;
|
||||
$overallmarkdifference = $step->sumgrades - $stats->sumgradeaverage;
|
||||
|
||||
$sortedmarkdifference = array_shift($stats->markarray) - $stats->markaverage;
|
||||
$sortedothermarkdifference = array_shift($stats->othermarksarray) -
|
||||
|
||||
@@ -676,7 +676,6 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
return $this->get_emtpy_stats($questions, $firstattempts->countrecs,
|
||||
$allattempts->countrecs);
|
||||
}
|
||||
$summarksavg = $usingattempts->total / $usingattempts->countrecs;
|
||||
|
||||
$quizstats = new stdClass();
|
||||
$quizstats->allattempts = $useallattempts;
|
||||
@@ -750,7 +749,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
}
|
||||
}
|
||||
|
||||
$qstats = new quiz_statistics_question_stats($questions, $s, $summarksavg);
|
||||
$qstats = new quiz_statistics_question_stats($questions);
|
||||
$qstats->load_step_data($quizid, $currentgroup, $groupstudents, $useallattempts);
|
||||
$qstats->compute_statistics();
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class quiz_statistics_question_stats_testcase extends basic_testcase {
|
||||
// Data is taken from questions mostly generated by
|
||||
// contrib/tools/generators/generator.php.
|
||||
$questions = $this->get_records_from_csv(__DIR__.'/fixtures/mdl_question.csv');
|
||||
$this->qstats = new testable_quiz_statistics_question_stats($questions, 22, 10045.45455);
|
||||
$this->qstats = new testable_quiz_statistics_question_stats($questions);
|
||||
$this->qstats->set_step_data($steps);
|
||||
$this->qstats->compute_statistics();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user