Merge branch 'MDL-44980-master-v2' of git://github.com/jamiepratt/moodle

This commit is contained in:
Dan Poltawski 2014-04-11 12:55:15 +08:00
commit d6a756a949
7 changed files with 12 additions and 19 deletions

View File

@ -0,0 +1,2 @@
slot,type,which,cat,mark
1,calculatedsimple,sumwithvariants,maincat,1
1 slot type which cat mark
2 1 calculatedsimple sumwithvariants maincat 1

View File

@ -2,3 +2,4 @@ testnumber,preferredbehaviour
00,deferredfeedback
01,interactive
02,interactive
03,deferredfeedback

1 testnumber preferredbehaviour
2 00 deferredfeedback
3 01 interactive
4 02 interactive
5 03 deferredfeedback

View File

@ -0,0 +1,2 @@
slot,variant,modelresponse,actualresponse,totalcount
1,4,"{a} + {b} (±0.01 Relative)",19.4,1
1 slot variant modelresponse actualresponse totalcount
2 1 4 {a} + {b} (±0.01 Relative) 19.4 1

View File

@ -0,0 +1,2 @@
quizattempt,firstname,lastname,responses.1.answer,variants.1
1,John,Jones,19.4,4
1 quizattempt firstname lastname responses.1.answer variants.1
2 1 John Jones 19.4 4

View File

@ -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);
}

View File

@ -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();

View File

@ -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);