MDL-14209 "quiz stats report:Seperation of functionality and unit tests for calculations" Seperating out call for processing actual student responses from calculation of other grade stats as I want to unit test the grade stats calculations.

This commit is contained in:
jamiesensei 2008-10-29 10:00:44 +00:00
parent 2f17b76d4b
commit 45cf6fd910
2 changed files with 13 additions and 1 deletions

View File

@ -94,7 +94,6 @@ class qstats{
} else {
$question =& $this->questions[$stats->questionid];
}
$this->_process_actual_responses($question, $state);
}
@ -269,6 +268,18 @@ class qstats{
$this->questions[$qid]->_stats->effectiveweight = null;
}
}
}
function process_responses(){
foreach ($this->states as $state){
if ($this->questions[$state->question]->qtype == 'random'){
if ($realstate = question_get_real_state($state)){
$this->_process_actual_responses($this->subquestions[$realstate->question], $realstate);
}
} else {
$this->_process_actual_responses($this->questions[$state->question], $state);
}
}
$this->responses = quiz_report_unindex($this->responses);
}
/**

View File

@ -565,6 +565,7 @@ class quiz_statistics_report extends quiz_default_report {
$qstats = new qstats($questions, $s, $sumgradesavg);
$qstats->get_records($quizid, $currentgroup, $groupstudents, $useallattempts);
$qstats->process_states();
$qstats->process_responses();
} else {
$qstats = false;
}