|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00028 defined('MOODLE_INTERNAL') || die(); 00029 00030 require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/helper.php'); 00031 00032 00039 class qtype_shortanswer_attempt_upgrader_test extends question_attempt_upgrader_test_base { 00040 00041 public function test_shortanswer_deferredfeedback_history620() { 00042 $quiz = (object) array( 00043 'id' => '221', 00044 'course' => '187', 00045 'name' => 'Practice CTMA04', 00046 'intro' => 'This is the Practice CTMA04. Your mark for this CTMA <span style="font-style: italic">does not </span>contribute to your continuous assessment mark for B680.<br /><br />This CTMA covers material primarily in Books 10 and 11, however some of the questions may return to material you covered in Books 0 to 9. There are 100 questions in total.<br /><br />It is a function of this testing software that it cannot provide for every possible spelling error that you make. The onus is therefore on you, the student, to ensure that your spelling is correct. ', 00047 'introformat' => FORMAT_HTML, 00048 'questiondecimalpoints' => '-1', 00049 'showuserpicture' => '1', 00050 'showblocks' => '1', 00051 'timeopen' => '1178492400', 00052 'timeclose' => '1193875200', 00053 'preferredbehaviour' => 'deferredfeedback', 00054 'attempts' => '0', 00055 'attemptonlast' => '0', 00056 'grademethod' => '1', 00057 'decimalpoints' => '2', 00058 'review' => '71727591', 00059 'questionsperpage' => '1', 00060 'shufflequestions' => '0', 00061 'shuffleanswers' => '0', 00062 'questions' => '4184,0,4185,0,4154,0,4186,0,4187,0,4188,0,4189,0,4190,0,4162,0,4191,0,4192,0,4193,0,4254,0,4195,0,4196,0,4163,0,4197,0,4198,0,4199,0,4164,0,4200,0,4165,0,4201,0,4202,0,4166,0,4203,0,4204,0,4205,0,4167,0,4155,0,4168,0,4206,0,4207,0,4208,0,4209,0,4210,0,4211,0,4212,0,4213,0,4214,0,4156,0,4215,0,4216,0,4217,0,4169,0,4170,0,4157,0,4218,0,4219,0,4220,0,4171,0,4221,0,4172,0,4222,0,4223,0,4224,0,4225,0,4226,0,4227,0,4228,0,4173,0,4229,0,4230,0,4231,0,4232,0,4174,0,4233,0,4234,0,4235,0,4236,0,4237,0,4238,0,4239,0,4240,0,4241,0,4242,0,4158,0,4243,0,4244,0,4245,0,4246,0,4159,0,4175,0,4247,0,4176,0,4248,0,4177,0,4160,0,4249,0,4178,0,4250,0,4161,0,4251,0,4179,0,4252,0,4180,0,4181,0,4182,0,4253,0,4183,0', 00063 'sumgrades' => '100', 00064 'grade' => '100', 00065 'timecreated' => '0', 00066 'timemodified' => '1195232889', 00067 'password' => '', 00068 'subnet' => '', 00069 'popup' => '0', 00070 'delay1' => '0', 00071 'delay2' => '0', 00072 'timelimit' => '0', 00073 ); 00074 $attempt = (object) array( 00075 'id' => '4025', 00076 'uniqueid' => '4025', 00077 'quiz' => '221', 00078 'userid' => '55568', 00079 'attempt' => '1', 00080 'sumgrades' => '30', 00081 'timestart' => '1178549306', 00082 'timefinish' => '1178641326', 00083 'timemodified' => '1178549306', 00084 'layout' => '4184,0,4185,0,4154,0,4186,0,4187,0,4188,0,4189,0,4190,0,4162,0,4191,0,4192,0,4193,0,4254,0,4195,0,4196,0,4163,0,4197,0,4198,0,4199,0,4164,0,4200,0,4165,0,4201,0,4202,0,4166,0,4203,0,4204,0,4205,0,4167,0,4155,0,4168,0,4206,0,4207,0,4208,0,4209,0,4210,0,4211,0,4212,0,4213,0,4214,0,4156,0,4215,0,4216,0,4217,0,4169,0,4170,0,4157,0,4218,0,4219,0,4220,0,4171,0,4221,0,4172,0,4222,0,4223,0,4224,0,4225,0,4226,0,4227,0,4228,0,4173,0,4229,0,4230,0,4231,0,4232,0,4174,0,4233,0,4234,0,4235,0,4236,0,4237,0,4238,0,4239,0,4240,0,4241,0,4242,0,4158,0,4243,0,4244,0,4245,0,4246,0,4159,0,4175,0,4247,0,4176,0,4248,0,4177,0,4160,0,4249,0,4178,0,4250,0,4161,0,4251,0,4179,0,4252,0,4180,0,4181,0,4182,0,4253,0,4183,0', 00085 'preview' => '0', 00086 'needsupgradetonewqe' => '1', 00087 ); 00088 $question = (object) array( 00089 'id' => '4239', 00090 'category' => '204', 00091 'parent' => '0', 00092 'name' => '4hdP73 Book 11 Section 2.1 ignore unavoidable costs when analysing data', 00093 'questiontext' => 'Complete the following sentence. 00094 <p>In general, the procedures for analysing cost data for decision making are: </p> 00095 <p>Ignore all sunk costs, ignore all ______ costs, use remaining costs for decision making purposes. </p>', 00096 'questiontextformat' => '1', 00097 'defaultmark' => '1', 00098 'penalty' => '1', 00099 'qtype' => 'shortanswer', 00100 'length' => '1', 00101 'stamp' => 'learn.open.ac.uk+070417143728+6z2qbB', 00102 'version' => 'learn.open.ac.uk+070417143728+BJ8YOd', 00103 'hidden' => '0', 00104 'generalfeedback' => '', 00105 'generalfeedbackformat' => '1', 00106 'timecreated' => '0', 00107 'timemodified' => '0', 00108 'createdby' => null, 00109 'modifiedby' => null, 00110 'unlimited' => null, 00111 'maxmark' => '1', 00112 'options' => (object) array( 00113 'answers' => array( 00114 12944 => (object) array( 00115 'question' => '4239', 00116 'answer' => 'unavoidable*', 00117 'fraction' => '1', 00118 'feedback' => 'Yes, the correct answer is unavoidable costs. Well done! <p> Book 11 Section 2.1', 00119 'id' => 12944, 00120 ), 00121 12945 => (object) array( 00122 'question' => '4239', 00123 'answer' => 'irrelevant*', 00124 'fraction' => '1', 00125 'feedback' => 'Yes, the correct answer is unavoidable (or \'irrelevant\') costs. Well done! <p> Book 11 Section 2.1', 00126 'id' => 12945, 00127 ), 00128 12946 => (object) array( 00129 'question' => '4239', 00130 'answer' => 'comitte*', 00131 'fraction' => '1', 00132 'feedback' => 'Yes, the correct answer is unavoidable costs. Well done! <i> <p> Book 11 Section 2.1', 00133 'id' => 12946, 00134 ), 00135 12947 => (object) array( 00136 'question' => '4239', 00137 'answer' => 'commite*', 00138 'fraction' => '1', 00139 'feedback' => 'Yes, the correct answer is unavoidable costs. Well done! <i> <p> Book 11 Section 2.1', 00140 'id' => 12947, 00141 ), 00142 12948 => (object) array( 00143 'question' => '4239', 00144 'answer' => '*', 00145 'fraction' => '0', 00146 'feedback' => 'The correct answer is unavoidable costs. <p> Book 11 Section 2.1', 00147 'id' => 12948, 00148 ), 00149 ), 00150 'usecase' => '0', 00151 ), 00152 'hints' => false, 00153 ); 00154 $qsession = (object) array( 00155 'id' => '39422', 00156 'attemptid' => '4025', 00157 'questionid' => '4239', 00158 'newest' => '94517', 00159 'newgraded' => '94517', 00160 'sumpenalty' => '1', 00161 'manualcomment' => '', 00162 'manualcommentformat' => '1', 00163 'flagged' => '1', 00164 ); 00165 $qstates = array( 00166 92129 => (object) array( 00167 'attempt' => '4025', 00168 'question' => '4239', 00169 'originalquestion' => '0', 00170 'seq_number' => '0', 00171 'answer' => '', 00172 'timestamp' => '1178549306', 00173 'event' => '0', 00174 'grade' => '0', 00175 'raw_grade' => '0', 00176 'penalty' => '0', 00177 'id' => 92129, 00178 ), 00179 94433 => (object) array( 00180 'attempt' => '4025', 00181 'question' => '4239', 00182 'originalquestion' => '0', 00183 'seq_number' => '1', 00184 'answer' => 'irrelevant', 00185 'timestamp' => '1178639607', 00186 'event' => '2', 00187 'grade' => '0', 00188 'raw_grade' => '1', 00189 'penalty' => '1', 00190 'id' => 94433, 00191 ), 00192 94517 => (object) array( 00193 'attempt' => '4025', 00194 'question' => '4239', 00195 'originalquestion' => '0', 00196 'seq_number' => '2', 00197 'answer' => 'irrelevant', 00198 'timestamp' => '1178639607', 00199 'event' => '6', 00200 'grade' => '1', 00201 'raw_grade' => '1', 00202 'penalty' => '1', 00203 'id' => 94517, 00204 ), 00205 ); 00206 00207 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 00208 00209 $expectedqa = (object) array( 00210 'behaviour' => 'deferredfeedback', 00211 'questionid' => 4239, 00212 'variant' => 1, 00213 'maxmark' => 1, 00214 'minfraction' => 0, 00215 'flagged' => 0, 00216 'questionsummary' => "Complete the following sentence. \n\nIn general, the procedures for analysing cost data for decision making are: \n\nIgnore all sunk costs, ignore all ______ costs, use remaining costs for decision making purposes.", 00217 'rightanswer' => 'unavoidable*', 00218 'responsesummary' => 'irrelevant', 00219 'timemodified' => 1178639607, 00220 'steps' => array( 00221 0 => (object) array( 00222 'sequencenumber' => 0, 00223 'state' => 'todo', 00224 'fraction' => null, 00225 'timecreated' => 1178549306, 00226 'userid' => 55568, 00227 'data' => array(), 00228 ), 00229 1 => (object) array( 00230 'sequencenumber' => 1, 00231 'state' => 'complete', 00232 'fraction' => null, 00233 'timecreated' => 1178639607, 00234 'userid' => 55568, 00235 'data' => array('answer' => 'irrelevant'), 00236 ), 00237 2 => (object) array( 00238 'sequencenumber' => 2, 00239 'state' => 'gradedright', 00240 'fraction' => 1, 00241 'timecreated' => 1178639607, 00242 'userid' => 55568, 00243 'data' => array('answer' => 'irrelevant', '-finish' => 1), 00244 ), 00245 ), 00246 ); 00247 00248 $this->compare_qas($expectedqa, $qa); 00249 } 00250 00251 public function test_shortanswer_deferredfeedback_history60() { 00252 $quiz = (object) array( 00253 'id' => '789', 00254 'course' => '3500', 00255 'name' => 'Modes of integration quiz', 00256 'intro' => '<p><font size="2">Use this quiz to test your knowledge of when you have completed <span style="font-style: italic">Modes of Integration</span>.</font> </p> 00257 <p><font size="2">This quiz is for your information only, the results will not be used as part of the work based activity. </font></p>', 00258 'introformat' => FORMAT_HTML, 00259 'questiondecimalpoints' => '-1', 00260 'showuserpicture' => '1', 00261 'showblocks' => '1', 00262 'timeopen' => '1147960800', 00263 'timeclose' => '1233414000', 00264 'preferredbehaviour' => 'deferredfeedback', 00265 'attempts' => '0', 00266 'attemptonlast' => '0', 00267 'grademethod' => '1', 00268 'decimalpoints' => '2', 00269 'review' => '71760879', 00270 'questionsperpage' => '0', 00271 'shufflequestions' => '1', 00272 'shuffleanswers' => '1', 00273 'questions' => '10218,10216,10219,10220,10217,0', 00274 'sumgrades' => '5', 00275 'grade' => '5', 00276 'timecreated' => '0', 00277 'timemodified' => '1191939532', 00278 'password' => '', 00279 'subnet' => '', 00280 'popup' => '0', 00281 'delay1' => '0', 00282 'delay2' => '0', 00283 'timelimit' => '0', 00284 ); 00285 $attempt = (object) array( 00286 'id' => '17778', 00287 'uniqueid' => '17778', 00288 'quiz' => '789', 00289 'userid' => '111471', 00290 'attempt' => '1', 00291 'sumgrades' => '4.6', 00292 'timestart' => '1161205933', 00293 'timefinish' => '1161206024', 00294 'timemodified' => '1161206024', 00295 'layout' => '10219,10220,10216,10217,10218,0', 00296 'preview' => '0', 00297 'needsupgradetonewqe' => '1', 00298 ); 00299 $question = (object) array( 00300 'id' => '10216', 00301 'category' => '528', 00302 'parent' => '0', 00303 'name' => 'Q2', 00304 'questiontext' => '<font size="2">In information-oriented integration what is the document which describes all the data structures in a potential integrated system and their relationships, for example, the fact that one database contained on a server will consist of a subset of another database contained in another server?</font>', 00305 'questiontextformat' => '1', 00306 'defaultmark' => '1', 00307 'penalty' => '0.1', 00308 'qtype' => 'shortanswer', 00309 'length' => '1', 00310 'stamp' => 'vledemo.open.ac.uk+060512111049+aApRic', 00311 'version' => 'vledemo.open.ac.uk+060719152101+aydsEU', 00312 'hidden' => '0', 00313 'generalfeedback' => '', 00314 'generalfeedbackformat' => '1', 00315 'timecreated' => '0', 00316 'timemodified' => '0', 00317 'createdby' => null, 00318 'modifiedby' => null, 00319 'unlimited' => null, 00320 'maxmark' => '1', 00321 'options' => (object) array( 00322 'answers' => array( 00323 31846 => (object) array( 00324 'question' => '10216', 00325 'answer' => '*Enterprise data model*', 00326 'fraction' => '1', 00327 'feedback' => 'It is the \'Enterprise data model\'.', 00328 'id' => 31846, 00329 ), 00330 31847 => (object) array( 00331 'question' => '10216', 00332 'answer' => '*Enterprise*', 00333 'fraction' => '0.8', 00334 'feedback' => 'It is the \'Enterprise data model\'.', 00335 'id' => 31847, 00336 ), 00337 31848 => (object) array( 00338 'question' => '10216', 00339 'answer' => '*', 00340 'fraction' => '0', 00341 'feedback' => 'It is the \'Enterprise data model\'.', 00342 'id' => 31848, 00343 ), 00344 ), 00345 'usecase' => '0', 00346 ), 00347 'hints' => false, 00348 ); 00349 $qsession = (object) array( 00350 'id' => '283784', 00351 'attemptid' => '17778', 00352 'questionid' => '10216', 00353 'newest' => '677550', 00354 'newgraded' => '677550', 00355 'sumpenalty' => '0', 00356 'manualcomment' => '', 00357 'manualcommentformat' => '1', 00358 'flagged' => '1', 00359 ); 00360 $qstates = array( 00361 677543 => (object) array( 00362 'attempt' => '17778', 00363 'question' => '10216', 00364 'originalquestion' => '0', 00365 'seq_number' => '0', 00366 'answer' => '', 00367 'timestamp' => '1161205933', 00368 'event' => '0', 00369 'grade' => '0', 00370 'raw_grade' => '0', 00371 'penalty' => '0', 00372 'id' => 677543, 00373 ), 00374 677550 => (object) array( 00375 'attempt' => '17778', 00376 'question' => '10216', 00377 'originalquestion' => '0', 00378 'seq_number' => '1', 00379 'answer' => 'enterprise data dictionary', 00380 'timestamp' => '1161206024', 00381 'event' => '6', 00382 'grade' => '0.8', 00383 'raw_grade' => '0.8', 00384 'penalty' => '0.1', 00385 'id' => 677550, 00386 ), 00387 ); 00388 00389 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 00390 00391 $expectedqa = (object) array( 00392 'behaviour' => 'deferredfeedback', 00393 'questionid' => 10216, 00394 'variant' => 1, 00395 'maxmark' => 1, 00396 'minfraction' => 0, 00397 'flagged' => 0, 00398 'questionsummary' => 'In information-oriented integration what is the document which describes all the data structures in a potential integrated system and their relationships, for example, the fact that one database contained on a server will consist of a subset of another database contained in another server?', 00399 'rightanswer' => '*Enterprise data model*', 00400 'responsesummary' => 'enterprise data dictionary', 00401 'timemodified' => 1161206024, 00402 'steps' => array( 00403 0 => (object) array( 00404 'sequencenumber' => 0, 00405 'state' => 'todo', 00406 'fraction' => null, 00407 'timecreated' => 1161205933, 00408 'userid' => 111471, 00409 'data' => array(), 00410 ), 00411 1 => (object) array( 00412 'sequencenumber' => 1, 00413 'state' => 'gradedpartial', 00414 'fraction' => 0.8, 00415 'timecreated' => 1161206024, 00416 'userid' => 111471, 00417 'data' => array('answer' => 'enterprise data dictionary', '-finish' => 1), 00418 ), 00419 ), 00420 ); 00421 00422 $this->compare_qas($expectedqa, $qa); 00423 } 00424 00425 public function test_shortanswer_deferredfeedback_history3220() { 00426 $quiz = (object) array( 00427 'id' => '221', 00428 'course' => '187', 00429 'name' => 'Practice CTMA04', 00430 'intro' => 'This is the Practice CTMA04. Your mark for this CTMA <span style="font-style: italic">does not </span>contribute to your continuous assessment mark for B680.<br /><br />This CTMA covers material primarily in Books 10 and 11, however some of the questions may return to material you covered in Books 0 to 9. There are 100 questions in total.<br /><br />It is a function of this testing software that it cannot provide for every possible spelling error that you make. The onus is therefore on you, the student, to ensure that your spelling is correct. ', 00431 'introformat' => FORMAT_HTML, 00432 'questiondecimalpoints' => '-1', 00433 'showuserpicture' => '1', 00434 'showblocks' => '1', 00435 'timeopen' => '1178492400', 00436 'timeclose' => '1193875200', 00437 'preferredbehaviour' => 'deferredfeedback', 00438 'attempts' => '0', 00439 'attemptonlast' => '0', 00440 'grademethod' => '1', 00441 'decimalpoints' => '2', 00442 'review' => '71727591', 00443 'questionsperpage' => '1', 00444 'shufflequestions' => '0', 00445 'shuffleanswers' => '0', 00446 'questions' => '4184,0,4185,0,4154,0,4186,0,4187,0,4188,0,4189,0,4190,0,4162,0,4191,0,4192,0,4193,0,4254,0,4195,0,4196,0,4163,0,4197,0,4198,0,4199,0,4164,0,4200,0,4165,0,4201,0,4202,0,4166,0,4203,0,4204,0,4205,0,4167,0,4155,0,4168,0,4206,0,4207,0,4208,0,4209,0,4210,0,4211,0,4212,0,4213,0,4214,0,4156,0,4215,0,4216,0,4217,0,4169,0,4170,0,4157,0,4218,0,4219,0,4220,0,4171,0,4221,0,4172,0,4222,0,4223,0,4224,0,4225,0,4226,0,4227,0,4228,0,4173,0,4229,0,4230,0,4231,0,4232,0,4174,0,4233,0,4234,0,4235,0,4236,0,4237,0,4238,0,4239,0,4240,0,4241,0,4242,0,4158,0,4243,0,4244,0,4245,0,4246,0,4159,0,4175,0,4247,0,4176,0,4248,0,4177,0,4160,0,4249,0,4178,0,4250,0,4161,0,4251,0,4179,0,4252,0,4180,0,4181,0,4182,0,4253,0,4183,0', 00447 'sumgrades' => '100', 00448 'grade' => '100', 00449 'timecreated' => '0', 00450 'timemodified' => '1195232889', 00451 'password' => '', 00452 'subnet' => '', 00453 'popup' => '0', 00454 'delay1' => '0', 00455 'delay2' => '0', 00456 'timelimit' => '0', 00457 ); 00458 $attempt = (object) array( 00459 'id' => '4058', 00460 'uniqueid' => '4058', 00461 'quiz' => '221', 00462 'userid' => '83485', 00463 'attempt' => '1', 00464 'sumgrades' => '19', 00465 'timestart' => '1178636138', 00466 'timefinish' => '1178874880', 00467 'timemodified' => '1178636138', 00468 'layout' => '4184,0,4185,0,4154,0,4186,0,4187,0,4188,0,4189,0,4190,0,4162,0,4191,0,4192,0,4193,0,4254,0,4195,0,4196,0,4163,0,4197,0,4198,0,4199,0,4164,0,4200,0,4165,0,4201,0,4202,0,4166,0,4203,0,4204,0,4205,0,4167,0,4155,0,4168,0,4206,0,4207,0,4208,0,4209,0,4210,0,4211,0,4212,0,4213,0,4214,0,4156,0,4215,0,4216,0,4217,0,4169,0,4170,0,4157,0,4218,0,4219,0,4220,0,4171,0,4221,0,4172,0,4222,0,4223,0,4224,0,4225,0,4226,0,4227,0,4228,0,4173,0,4229,0,4230,0,4231,0,4232,0,4174,0,4233,0,4234,0,4235,0,4236,0,4237,0,4238,0,4239,0,4240,0,4241,0,4242,0,4158,0,4243,0,4244,0,4245,0,4246,0,4159,0,4175,0,4247,0,4176,0,4248,0,4177,0,4160,0,4249,0,4178,0,4250,0,4161,0,4251,0,4179,0,4252,0,4180,0,4181,0,4182,0,4253,0,4183,0', 00469 'preview' => '0', 00470 'needsupgradetonewqe' => '1', 00471 ); 00472 $question = (object) array( 00473 'id' => '4184', 00474 'category' => '204', 00475 'parent' => '0', 00476 'name' => '4abP1 Book 11 Section 3.1 capit invest appraisal defn', 00477 'questiontext' => 'Complete the following sentence by providing an appropriate word for the indicated gap. 00478 <p>Capital investment appraisal involves both quantitative and ______ issues. </p>', 00479 'questiontextformat' => '1', 00480 'defaultmark' => '1', 00481 'penalty' => '1', 00482 'qtype' => 'shortanswer', 00483 'length' => '1', 00484 'stamp' => 'learn.open.ac.uk+070417143727+tO4yGs', 00485 'version' => 'learn.open.ac.uk+070417143727+fieanX', 00486 'hidden' => '0', 00487 'generalfeedback' => '', 00488 'generalfeedbackformat' => '1', 00489 'timecreated' => '0', 00490 'timemodified' => '0', 00491 'createdby' => null, 00492 'modifiedby' => null, 00493 'unlimited' => null, 00494 'maxmark' => '1', 00495 'options' => (object) array( 00496 'answers' => array( 00497 12768 => (object) array( 00498 'question' => '4184', 00499 'answer' => 'qualitative*', 00500 'fraction' => '1', 00501 'feedback' => 'Yes, the correct answer is qualitative issues. Well done! <p> Book 11 Section 3.1', 00502 'id' => 12768, 00503 ), 00504 12769 => (object) array( 00505 'question' => '4184', 00506 'answer' => 'qual*tat*ve*', 00507 'fraction' => '1', 00508 'feedback' => 'Yes, the correct answer is qualitative issues. Well done! <i>(but watch your spelling!)</i> <p> Book 11 Section 3.1', 00509 'id' => 12769, 00510 ), 00511 12770 => (object) array( 00512 'question' => '4184', 00513 'answer' => '*', 00514 'fraction' => '0', 00515 'feedback' => 'The correct answer is qualitative issues. <p> Book 11 Section 3.1', 00516 'id' => 12770, 00517 ), 00518 ), 00519 'usecase' => '0', 00520 ), 00521 'hints' => false, 00522 ); 00523 $qsession = (object) array( 00524 'id' => '40854', 00525 'attemptid' => '4058', 00526 'questionid' => '4184', 00527 'newest' => '100733', 00528 'newgraded' => '100733', 00529 'sumpenalty' => '1', 00530 'manualcomment' => '', 00531 'manualcommentformat' => '1', 00532 'flagged' => '1', 00533 ); 00534 $qstates = array( 00535 94330 => (object) array( 00536 'attempt' => '4058', 00537 'question' => '4184', 00538 'originalquestion' => '0', 00539 'seq_number' => '0', 00540 'answer' => '', 00541 'timestamp' => '1178636138', 00542 'event' => '0', 00543 'grade' => '0', 00544 'raw_grade' => '0', 00545 'penalty' => '0', 00546 'id' => 94330, 00547 ), 00548 94415 => (object) array( 00549 'attempt' => '4058', 00550 'question' => '4184', 00551 'originalquestion' => '0', 00552 'seq_number' => '1', 00553 'answer' => 'qualitative', 00554 'timestamp' => '1178636171', 00555 'event' => '2', 00556 'grade' => '0', 00557 'raw_grade' => '1', 00558 'penalty' => '1', 00559 'id' => 94415, 00560 ), 00561 100142 => (object) array( 00562 'attempt' => '4058', 00563 'question' => '4184', 00564 'originalquestion' => '0', 00565 'seq_number' => '2', 00566 'answer' => 'subjective', 00567 'timestamp' => '1178825180', 00568 'event' => '2', 00569 'grade' => '0', 00570 'raw_grade' => '0', 00571 'penalty' => '1', 00572 'id' => 100142, 00573 ), 00574 100733 => (object) array( 00575 'attempt' => '4058', 00576 'question' => '4184', 00577 'originalquestion' => '0', 00578 'seq_number' => '3', 00579 'answer' => 'subjective', 00580 'timestamp' => '1178825180', 00581 'event' => '3', 00582 'grade' => '0', 00583 'raw_grade' => '0', 00584 'penalty' => '1', 00585 'id' => 100733, 00586 ), 00587 ); 00588 00589 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 00590 00591 $expectedqa = (object) array( 00592 'behaviour' => 'deferredfeedback', 00593 'questionid' => 4184, 00594 'variant' => 1, 00595 'maxmark' => 1, 00596 'minfraction' => 0, 00597 'flagged' => 0, 00598 'questionsummary' => "Complete the following sentence by providing an appropriate word for the indicated gap. \n\nCapital investment appraisal involves both quantitative and ______ issues.", 00599 'rightanswer' => 'qualitative*', 00600 'responsesummary' => 'subjective', 00601 'timemodified' => 1178825180, 00602 'steps' => array( 00603 0 => (object) array( 00604 'sequencenumber' => 0, 00605 'state' => 'todo', 00606 'fraction' => null, 00607 'timecreated' => 1178636138, 00608 'userid' => 83485, 00609 'data' => array(), 00610 ), 00611 1 => (object) array( 00612 'sequencenumber' => 1, 00613 'state' => 'complete', 00614 'fraction' => null, 00615 'timecreated' => 1178636171, 00616 'userid' => 83485, 00617 'data' => array('answer' => 'qualitative'), 00618 ), 00619 2 => (object) array( 00620 'sequencenumber' => 2, 00621 'state' => 'complete', 00622 'fraction' => null, 00623 'timecreated' => 1178825180, 00624 'userid' => 83485, 00625 'data' => array('answer' => 'subjective'), 00626 ), 00627 3 => (object) array( 00628 'sequencenumber' => 3, 00629 'state' => 'gradedwrong', 00630 'fraction' => 0, 00631 'timecreated' => 1178825180, 00632 'userid' => 83485, 00633 'data' => array('answer' => 'subjective', '-finish' => 1), 00634 ), 00635 ), 00636 ); 00637 00638 $this->compare_qas($expectedqa, $qa); 00639 } 00640 }