mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-44980-master-v2' of git://github.com/jamiepratt/moodle
This commit is contained in:
commit
d6a756a949
2
mod/quiz/report/statistics/tests/fixtures/questions03.csv
vendored
Normal file
2
mod/quiz/report/statistics/tests/fixtures/questions03.csv
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
slot,type,which,cat,mark
|
||||
1,calculatedsimple,sumwithvariants,maincat,1
|
|
@ -2,3 +2,4 @@ testnumber,preferredbehaviour
|
||||
00,deferredfeedback
|
||||
01,interactive
|
||||
02,interactive
|
||||
03,deferredfeedback
|
||||
|
|
2
mod/quiz/report/statistics/tests/fixtures/responsecounts03.csv
vendored
Normal file
2
mod/quiz/report/statistics/tests/fixtures/responsecounts03.csv
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
slot,variant,modelresponse,actualresponse,totalcount
|
||||
1,4,"{a} + {b} (±0.01 Relative)",19.4,1
|
|
2
mod/quiz/report/statistics/tests/fixtures/steps03.csv
vendored
Normal file
2
mod/quiz/report/statistics/tests/fixtures/steps03.csv
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
quizattempt,firstname,lastname,responses.1.answer,variants.1
|
||||
1,John,Jones,19.4,4
|
|
@ -136,20 +136,6 @@ class all_calculated_for_qubaid_condition {
|
||||
return array_keys($this->questionstats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of variants of one randomly selected question that have appeared in the attempt data.
|
||||
*
|
||||
* @param int $questionid The id for the sub question.
|
||||
* @return int[] The variant nos.
|
||||
*/
|
||||
public function get_variants_for_subq($questionid) {
|
||||
if (count($this->subquestionstats[$questionid]->variantstats) > 1) {
|
||||
return array_keys($this->subquestionstats[$questionid]->variantstats);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get position stats instance for a slot and optional variant no.
|
||||
*
|
||||
@ -351,7 +337,7 @@ class all_calculated_for_qubaid_condition {
|
||||
$toreturn = array();
|
||||
$displayorder = 1;
|
||||
foreach ($this->for_slot($slot)->get_sub_question_ids() as $subqid) {
|
||||
if ($variants = $this->get_variants_for_subq($subqid)) {
|
||||
if ($variants = $this->for_subq($subqid)->get_variants()) {
|
||||
foreach ($variants as $variant) {
|
||||
$toreturn[] = $this->make_new_subq_stat_for($displayorder, $slot, $subqid, $variant);
|
||||
}
|
||||
@ -406,7 +392,7 @@ class all_calculated_for_qubaid_condition {
|
||||
$displaynumber = 1;
|
||||
foreach ($this->for_slot($slot)->get_sub_question_ids() as $subqid) {
|
||||
$toreturn[] = $this->make_new_subq_stat_for($displaynumber, $slot, $subqid);
|
||||
if ($variants = $this->get_variants_for_subq($subqid)) {
|
||||
if ($variants = $this->for_subq($subqid)->get_variants()) {
|
||||
foreach ($variants as $variant) {
|
||||
$toreturn[] = $this->make_new_subq_stat_for($displaynumber, $slot, $subqid, $variant);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ class calculated {
|
||||
}
|
||||
$DB->insert_record('question_statistics', $toinsert, false);
|
||||
|
||||
if (count($this->variantstats) > 1) {
|
||||
if ($this->get_variants()) {
|
||||
foreach ($this->variantstats as $variantstat) {
|
||||
$variantstat->cache($qubaids);
|
||||
}
|
||||
@ -276,7 +276,7 @@ class calculated {
|
||||
*/
|
||||
public function get_variants() {
|
||||
$variants = array_keys($this->variantstats);
|
||||
if (count($variants) > 1) {
|
||||
if (count($variants) > 1 || reset($variants) != 1) {
|
||||
return $variants;
|
||||
} else {
|
||||
return array();
|
||||
|
@ -161,7 +161,7 @@ class calculator {
|
||||
$this->stats->for_subq($qid)->question = $subquestion;
|
||||
$this->stats->for_subq($qid)->randomguessscore = $this->get_random_guess_score($subquestion);
|
||||
|
||||
if ($variants = $this->stats->get_variants_for_subq($qid)) {
|
||||
if ($variants = $this->stats->for_subq($qid)->get_variants()) {
|
||||
foreach ($variants as $variant) {
|
||||
$this->stats->for_subq($qid, $variant)->question = $subquestion;
|
||||
$this->stats->for_subq($qid, $variant)->randomguessscore = $this->get_random_guess_score($subquestion);
|
||||
|
Loading…
x
Reference in New Issue
Block a user