diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index c1921cbc6ec..3441703b3a4 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -202,8 +202,10 @@ delete_records('quiz_grades', 'quiz', $quiz->id, 'userid', $USER->id); foreach ($oldattempts as $oldattempt) { // there should only be one but we loop just in case + // TODO: the following should become a function in questionlib.php which + // really deletes all records associated to this attempt. delete_records('quiz_states', 'attempt', $oldattempt->uniqueid); - delete_records('quiz_newest_states', 'attemptid', $oldattempt->uniqueid); + delete_records('question_sessions', 'attemptid', $oldattempt->uniqueid); } } } @@ -340,7 +342,7 @@ // Find all the questions for this attempt for which the newest // state is not also the newest graded state - if ($closequestions = get_records_select('quiz_newest_states', + if ($closequestions = get_records_select('question_sessions', "attemptid = $attempt->uniqueid AND newest != newgraded", '', 'questionid, questionid')) { // load all the questions diff --git a/mod/quiz/backuplib.php b/mod/quiz/backuplib.php index 72f27fe5c0d..54296f0221f 100644 --- a/mod/quiz/backuplib.php +++ b/mod/quiz/backuplib.php @@ -17,7 +17,7 @@ // quiz_attempts quiz_question_instances . | | (CL,pk->id,fk->question, | . // (UL,pk->id,fk->quiz) (CL,pk->id,fk->quiz,question) . | | fk->dataset_definition) | . // | | . | | | . - // | quiz_newest_states | . | | | . + // | question_sessions | . | | | . // |---------(UL,pk->id,fk->attempt,question)-----| . | | | . // | . | . | | quiz_dataset_definitions // | . | . | | (CL,pk->id,fk->category) @@ -96,7 +96,7 @@ // - quiz_attempts // - quiz_grades // - quiz_states - // - quiz_newest_states + // - question_sessions // This step is the standard mod backup. (course dependent). //STEP 1. Backup categories/questions and associated structures @@ -961,13 +961,13 @@ //Write end tag $status =fwrite ($bf,end_tag("STATES",6,true)); } - $quiz_newest_states = get_records("quiz_newest_states","attemptid",$attempt,"id"); + $question_sessions = get_records("question_sessions","attemptid",$attempt,"id"); //If there are newest_states - if ($quiz_newest_states) { + if ($question_sessions) { //Write start tag $status =fwrite ($bf,start_tag("NEWEST_STATES",6,true)); //Iterate over each newest_state - foreach ($quiz_newest_states as $newest_state) { + foreach ($question_sessions as $newest_state) { //Start newest_state $status =fwrite ($bf,start_tag("NEWEST_STATE",7,true)); //Print newest_state contents diff --git a/mod/quiz/db/migrate2utf8.xml b/mod/quiz/db/migrate2utf8.xml index 5bf8aa211b5..1d2e269281b 100755 --- a/mod/quiz/db/migrate2utf8.xml +++ b/mod/quiz/db/migrate2utf8.xml @@ -39,7 +39,7 @@ - +
diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index 301d6b2bf1c..4860a0ea4ea 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -908,7 +908,7 @@ function quiz_upgrade($oldversion) { table_column('quiz_multianswers', 'sequence', 'sequence', 'text', '', '', '', 'not null', 'question'); } - if ($oldversion < 200602100) { + if ($oldversion < 2006021501) { execute_sql("ALTER TABLE {$CFG->prefix}quiz_newest_states RENAME {$CFG->prefix}question_sessions", false); } diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index db0988d6ec7..6e2d191ccb5 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -284,10 +284,10 @@ CREATE TABLE prefix_quiz_multichoice ( -- -------------------------------------------------------- -- --- Table structure for table `prefix_quiz_newest_states` +-- Table structure for table `prefix_question_sessions` -- -CREATE TABLE prefix_quiz_newest_states ( +CREATE TABLE prefix_question_sessions ( id int(10) unsigned NOT NULL auto_increment, attemptid int(10) unsigned NOT NULL default '0', questionid int(10) unsigned NOT NULL default '0', diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index d74274896e5..6c4b6dd009b 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -1005,7 +1005,7 @@ function quiz_upgrade($oldversion) { modify_database('','CREATE UNIQUE INDEX prefix_quiz_attempts_uniqueid_uk ON prefix_quiz_attempts (uniqueid);'); } - if ($oldversion < 200602100) { + if ($oldversion < 2006021501) { execute_sql("ALTER TABLE {$CFG->prefix}quiz_newest_states RENAME TO {$CFG->prefix}question_sessions", false); } diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql index f6634436eba..579e495fa27 100644 --- a/mod/quiz/db/postgres7.sql +++ b/mod/quiz/db/postgres7.sql @@ -251,11 +251,11 @@ CREATE INDEX prefix_quiz_multichoice_question_idx ON prefix_quiz_multichoice (qu # -------------------------------------------------------- # -# Table structure for table prefix_quiz_newest_states +# Table structure for table prefix_question_sessions # -CREATE TABLE prefix_quiz_newest_states ( +CREATE TABLE prefix_question_sessions ( id SERIAL PRIMARY KEY, attemptid integer NOT NULL default '0', questionid integer NOT NULL default '0', @@ -264,7 +264,7 @@ CREATE TABLE prefix_quiz_newest_states ( sumpenalty varchar(10) NOT NULL default '0.0' ); -CREATE UNIQUE INDEX prefix_quiz_newest_states_attempt_idx ON prefix_quiz_newest_states (attemptid,questionid); +CREATE UNIQUE INDEX prefix_question_sessions_attempt_idx ON prefix_question_sessions (attemptid,questionid); # -------------------------------------------------------- diff --git a/mod/quiz/grading.php b/mod/quiz/grading.php index 304fb689122..273abdb9efd 100644 --- a/mod/quiz/grading.php +++ b/mod/quiz/grading.php @@ -122,7 +122,7 @@ $statefields = 'n.questionid as question, s.*, n.sumpenalty'; $sql = "SELECT $statefields". " FROM {$CFG->prefix}quiz_states s,". - " {$CFG->prefix}quiz_newest_states n". + " {$CFG->prefix}question_sessions n". " WHERE s.id = n.newest". " AND n.attemptid = '$attempt->uniqueid'". " AND n.questionid = $question->id"; @@ -150,7 +150,7 @@ $sumgrades = 0; $questionids = explode(',', quiz_questions_in_quiz($attempt->layout)); foreach($questionids as $questionid) { - $lastgradedid = get_field('quiz_newest_states', 'newgraded', 'attemptid', $attempt->uniqueid, 'questionid', $questionid); + $lastgradedid = get_field('question_sessions', 'newgraded', 'attemptid', $attempt->uniqueid, 'questionid', $questionid); $sumgrades += get_field('quiz_states', 'grade', 'id', $lastgradedid); } @@ -190,7 +190,7 @@ foreach ($attempts as $attempt) { // retrieve the state - if (!$neweststate = get_record('quiz_newest_states', 'attemptid', $attempt->uniqueid, 'questionid', $questionid)) { + if (!$neweststate = get_record('question_sessions', 'attemptid', $attempt->uniqueid, 'questionid', $questionid)) { error("Can not find newest states for attempt $attempt->uniqueid for question $questionid"); } if (! $state = get_record('quiz_states', 'id', $neweststate->newest)) { @@ -276,7 +276,7 @@ $ungraded = 0; foreach ($attempts as $attempt) { // grab the state then check if it is graded - if (!$neweststate = get_record('quiz_newest_states', 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { + if (!$neweststate = get_record('question_sessions', 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { error("Can not find newest states for attempt $attempt->uniqueid for question $question->id"); } if (!$questionstate = get_record('quiz_essay_states', 'stateid', $neweststate->newest)) { @@ -365,7 +365,7 @@ $attempt->firstname.' '.$attempt->lastname.''; // nab the state of the attempt to see if it is graded or not - if (!$neweststate = get_record('quiz_newest_states', 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { + if (!$neweststate = get_record('question_sessions', 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { error("Can not find newest states for attempt $attempt->uniqueid for question $questionid"); } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 0c26dee4105..1a7efa86d16 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -214,10 +214,11 @@ function quiz_delete_instance($id) { if ($attempts = get_records("quiz_attempts", "quiz", "$quiz->id")) { foreach ($attempts as $attempt) { + // TODO: this should use function in questionlib.php if (! delete_records("quiz_states", "attempt", "$attempt->uniqueid")) { $result = false; } - if (! delete_records("quiz_newest_states", "attemptid", "$attempt->uniqueid")) { + if (! delete_records("question_sessions", "attemptid", "$attempt->uniqueid")) { $result = false; } } diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 635de59371e..4851f0352aa 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -456,7 +456,7 @@ function quiz_parse_fieldname($name, $nameprefix='question') { * Any state that does not yet have its timestamp set to nonzero has not yet been upgraded from Moodle 1.4 * The reason these are still around is that for large sites it would have taken too long to * upgrade all states at once. This function sets the timestamp field and creates an entry in the -* quiz_newest_states table. +* question_sessions table. * @param object $attempt The attempt whose states need upgrading */ function quiz_upgrade_states($attempt) { @@ -467,7 +467,7 @@ function quiz_upgrade_states($attempt) { // We set the timestamp of all states to the timemodified field of the attempt. execute_sql("UPDATE {$CFG->prefix}quiz_states SET timestamp = '$attempt->timemodified' WHERE attempt = '$attempt->uniqueid'", false); - // For each state we create an entry in the quiz_newest_states table, with both newest and + // For each state we create an entry in the question_sessions table, with both newest and // newgraded pointing to this state. // Actually we only do this for states whose question is actually listed in $attempt->layout. // We do not do it for states associated to wrapped questions like for example the questions @@ -476,10 +476,10 @@ function quiz_upgrade_states($attempt) { $questionlist = quiz_questions_in_quiz($attempt->layout); if ($states = get_records_select('quiz_states', "attempt = '$attempt->uniqueid' AND question IN ($questionlist)")) { foreach ($states as $state) { - $newest->newgraded = $state->id; - $newest->newest = $state->id; - $newest->questionid = $state->question; - insert_record('quiz_newest_states', $newest, false); + $session->newgraded = $state->id; + $session->newest = $state->id; + $session->questionid = $state->question; + insert_record('question_sessions', $session, false); } } } diff --git a/mod/quiz/question.php b/mod/quiz/question.php index 0c7cbd1d6e9..c0cf861d605 100644 --- a/mod/quiz/question.php +++ b/mod/quiz/question.php @@ -252,8 +252,8 @@ // replace question id in states set_field('quiz_states', 'question', $question->id, 'attempt', $attempt->uniqueid, 'question', $oldquestionid); - // replace question id in newest_states - set_field('quiz_newest_states', 'questionid', $question->id, 'attemptid', $attempt->uniqueid, 'questionid', $oldquestionid); + // replace question id in sessions + set_field('question_sessions', 'questionid', $question->id, 'attemptid', $attempt->uniqueid, 'questionid', $oldquestionid); } diff --git a/mod/quiz/questionlib.php b/mod/quiz/questionlib.php index 7d550ddf11c..a0dc16549ec 100644 --- a/mod/quiz/questionlib.php +++ b/mod/quiz/questionlib.php @@ -127,7 +127,7 @@ function quiz_delete_question($question) { $QUIZ_QTYPES[$question->qtype]->delete_question($question); delete_records("quiz_answers", "question", $question->id); delete_records("quiz_states", "question", $question->id); - delete_records("quiz_newest_states", "questionid", $question->id); + delete_records("question_sessions", "questionid", $question->id); if ($newversions = get_records('quiz_question_versions', 'oldquestion', $question->id)) { foreach ($newversions as $newversion) { $newquestion = get_record('quiz_questions', 'id', $newversion->newquestion); @@ -210,7 +210,7 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) { // Load the newest states for the questions $sql = "SELECT $statefields". " FROM {$CFG->prefix}quiz_states s,". - " {$CFG->prefix}quiz_newest_states n". + " {$CFG->prefix}question_sessions n". " WHERE s.id = n.newest". " AND n.attemptid = '$attempt->uniqueid'". " AND n.questionid IN ($questionlist)"; @@ -219,7 +219,7 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) { // Load the newest graded states for the questions $sql = "SELECT $statefields". " FROM {$CFG->prefix}quiz_states s,". - " {$CFG->prefix}quiz_newest_states n". + " {$CFG->prefix}question_sessions n". " WHERE s.id = n.newgraded". " AND n.attemptid = '$attempt->uniqueid'". " AND n.questionid IN ($questionlist)"; @@ -246,7 +246,7 @@ function quiz_get_states(&$questions, $cmoptions, $attempt) { // Load the last graded state for the question $sql = "SELECT $statefields". " FROM {$CFG->prefix}quiz_states s,". - " {$CFG->prefix}quiz_newest_states n". + " {$CFG->prefix}question_sessions n". " WHERE s.id = n.newgraded". " AND n.attemptid = '$lastattemptid'". " AND n.questionid = '$i'"; @@ -332,7 +332,7 @@ function quiz_restore_state(&$question, &$state) { * The state object representing the current state of the session for the * question is saved to the quiz_states table with ->responses[''] saved * to the answer field of the database table. The information in the -* quiz_newest_states table is updated. +* question_sessions table is updated. * The question type specific data is then saved. * @return boolean Indicates success or failure. * @param object $question The question for which session is to be saved. @@ -371,26 +371,26 @@ function quiz_save_question_session(&$question, &$state) { } // this is the most recent state - if (!record_exists('quiz_newest_states', 'attemptid', + if (!record_exists('question_sessions', 'attemptid', $state->attempt, 'questionid', $question->id)) { $new->attemptid = $state->attempt; $new->questionid = $question->id; $new->newest = $state->id; $new->sumpenalty = $state->sumpenalty; - if (!insert_record('quiz_newest_states', $new)) { - error('Could not insert entry in quiz_newest_states'); + if (!insert_record('question_sessions', $new)) { + error('Could not insert entry in question_sessions'); } } else { - set_field('quiz_newest_states', 'newest', $state->id, 'attemptid', + set_field('question_sessions', 'newest', $state->id, 'attemptid', $state->attempt, 'questionid', $question->id); } if (quiz_state_is_graded($state)) { // this is also the most recent graded state - if ($newest = get_record('quiz_newest_states', 'attemptid', + if ($newest = get_record('question_sessions', 'attemptid', $state->attempt, 'questionid', $question->id)) { $newest->newgraded = $state->id; $newest->sumpenalty = $state->sumpenalty; - update_record('quiz_newest_states', $newest); + update_record('question_sessions', $newest); } } } diff --git a/mod/quiz/questiontypes/essay/questiontype.php b/mod/quiz/questiontypes/essay/questiontype.php index 63173c62ac1..6c09dac3e9d 100644 --- a/mod/quiz/questiontypes/essay/questiontype.php +++ b/mod/quiz/questiontypes/essay/questiontype.php @@ -285,7 +285,7 @@ class quiz_essay_qtype extends quiz_default_questiontype { // determine the number of ungraded attempts essays foreach ($attempts as $attempt) { // grab the state then check if it is graded - if (!$neweststate = get_record('quiz_newest_states', 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { + if (!$neweststate = get_record('question_sessions', 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { error("Can not find newest states for attempt $attempt->uniqueid for question $question->id"); } if (!$questionstate = get_record('quiz_essay_states', 'stateid', $neweststate->newest)) { diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index c846bd8324e..3460f220850 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -41,10 +41,10 @@ class quiz_report extends quiz_default_report { foreach($attemptids as $attemptid) { if ($todelete = get_record('quiz_attempts', 'id', $attemptid)) { - + // TODO: use function from questionlib.php to delete attempt delete_records('quiz_attempts', 'id', $attemptid); delete_records('quiz_states', 'attempt', $todelete->uniqueid); - delete_records('quiz_newest_states', 'attemptid', $todelete->uniqueid); + delete_records('question_sessions', 'attemptid', $todelete->uniqueid); // Search quiz_attempts for other instances by this user. // If none, then delete record for this quiz, this user from quiz_grades @@ -289,7 +289,7 @@ class quiz_report extends quiz_default_report { if(!$questionsort) { $qid = intval(substr($sortpart, 1)); $select .= ', grade '; - $from .= 'LEFT JOIN '.$CFG->prefix.'quiz_newest_states qns ON qns.attemptid = qa.attemptuniqueid '. + $from .= 'LEFT JOIN '.$CFG->prefix.'question_sessions qns ON qns.attemptid = qa.attemptuniqueid '. 'LEFT JOIN '.$CFG->prefix.'quiz_states qs ON qs.id = qns.newgraded '; $where .= ' AND ('.sql_isnull('qns.questionid').' OR qns.questionid = '.$qid.')'; $newsort[] = 'grade '.(strpos($sortpart, 'ASC')? 'ASC' : 'DESC'); diff --git a/mod/quiz/report/regrade/report.php b/mod/quiz/report/regrade/report.php index 79cab5eab09..8c5753809b5 100644 --- a/mod/quiz/report/regrade/report.php +++ b/mod/quiz/report/regrade/report.php @@ -53,7 +53,7 @@ class quiz_report extends quiz_default_report { $sumgrades = 0; $questionids = explode(',', quiz_questions_in_quiz($attempt->layout)); foreach($questionids as $questionid) { - $lastgradedid = get_field('quiz_newest_states', 'newgraded', 'attemptid', $attempt->uniqueid, 'questionid', $questionid); + $lastgradedid = get_field('question_sessions', 'newgraded', 'attemptid', $attempt->uniqueid, 'questionid', $questionid); $sumgrades += get_field('quiz_states', 'grade', 'id', $lastgradedid); } if ($attempt->sumgrades != $sumgrades) { diff --git a/mod/quiz/report/responses/report.php b/mod/quiz/report/responses/report.php index 961d411a345..0c9bd5dc6fb 100644 --- a/mod/quiz/report/responses/report.php +++ b/mod/quiz/report/responses/report.php @@ -177,7 +177,7 @@ class quiz_report extends quiz_default_report { if(!$questionsort) { $qid = intval(substr($sortpart, 1)); $select .= ', grade '; - $from .= 'LEFT JOIN '.$CFG->prefix.'quiz_newest_states qns ON qns.attemptid = qa.id '. + $from .= 'LEFT JOIN '.$CFG->prefix.'question_sessions qns ON qns.attemptid = qa.id '. 'LEFT JOIN '.$CFG->prefix.'quiz_states qs ON qs.id = qns.newgraded '; $where .= ' AND ('.sql_isnull('qns.questionid').' OR qns.questionid = '.$qid.')'; $newsort[] = 'answer '.(strpos($sortpart, 'ASC')? 'ASC' : 'DESC'); @@ -315,7 +315,7 @@ class quiz_report extends quiz_default_report { error('Could not restore question sessions'); } foreach($questionids as $questionid) { - $gradedstateid = get_field('quiz_newest_states', 'newgraded', 'attemptid', $attempt->id, 'questionid', $questionid); + $gradedstateid = get_field('question_sessions', 'newgraded', 'attemptid', $attempt->id, 'questionid', $questionid); $grade = round(get_field('quiz_states', 'grade', 'id', $gradedstateid), $quiz->decimalpoints); $responses = quiz_get_question_actual_response($questions[$questionid], $states[$questionid]); $response = implode(', ',$responses); diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php index 66f7576d2b2..11349a5bd54 100644 --- a/mod/quiz/restorelib.php +++ b/mod/quiz/restorelib.php @@ -25,7 +25,7 @@ // quiz_attempts quiz_question_instances . | | (CL,pk->id,fk->question, | . // (UL,pk->id,fk->quiz) (CL,pk->id,fk->quiz,question) . | | fk->dataset_definition) | . // | | . | | | . - // | quiz_newest_states | . | | | . + // | question_sessions | . | | | . // |---------(UL,pk->id,fk->attempt,question)-----| . | | | . // | . | . | | quiz_dataset_definitions // | . | . | | (CL,pk->id,fk->category) @@ -1838,42 +1838,42 @@ } } - //Get the quiz_newest_states array - $newest_states = $info['#']['NEWEST_STATES']['0']['#']['NEWEST_STATE']; - //Iterate over newest_states - for($i = 0; $i < sizeof($newest_states); $i++) { - $res_info = $newest_states[$i]; + //Get the question_sessions array + $sessions = $info['#']['NEWEST_STATES']['0']['#']['NEWEST_STATE']; + //Iterate over question_sessions + for($i = 0; $i < sizeof($sessions); $i++) { + $res_info = $sessions[$i]; //traverse_xmlize($res_info); //Debug //print_object ($GLOBALS['traverse_array']); //Debug //$GLOBALS['traverse_array']=""; //Debug //Now, build the NEWEST_STATES record structure - $newest_state->attemptid = $attempt_id; - $newest_state->questionid = backup_todb($res_info['#']['QUESTIONID']['0']['#']); - $newest_state->newest = backup_todb($res_info['#']['NEWEST']['0']['#']); - $newest_state->newgraded = backup_todb($res_info['#']['NEWGRADED']['0']['#']); - $newest_state->sumpenalty = backup_todb($res_info['#']['SUMPENALTY']['0']['#']); + $session->attemptid = $attempt_id; + $session->questionid = backup_todb($res_info['#']['QUESTIONID']['0']['#']); + $session->newest = backup_todb($res_info['#']['NEWEST']['0']['#']); + $session->newgraded = backup_todb($res_info['#']['NEWGRADED']['0']['#']); + $session->sumpenalty = backup_todb($res_info['#']['SUMPENALTY']['0']['#']); //We have to recode the question field - $question = backup_getid($restore->backup_unique_code,"quiz_questions",$newest_state->questionid); + $question = backup_getid($restore->backup_unique_code,"quiz_questions",$session->questionid); if ($question) { - $newest_state->questionid = $question->new_id; + $session->questionid = $question->new_id; } //We have to recode the newest field - $state = backup_getid($restore->backup_unique_code,"quiz_states",$newest_state->newest); + $state = backup_getid($restore->backup_unique_code,"quiz_states",$session->newest); if ($state) { - $newest_state->newest = $state->new_id; + $session->newest = $state->new_id; } //We have to recode the newgraded field - $state = backup_getid($restore->backup_unique_code,"quiz_states",$newest_state->newgraded); + $state = backup_getid($restore->backup_unique_code,"quiz_states",$session->newgraded); if ($state) { - $newest_state->newgraded = $state->new_id; + $session->newgraded = $state->new_id; } - //The structure is equal to the db, so insert the quiz_newest_states - $newid = insert_record ("quiz_newest_states",$newest_state); + //The structure is equal to the db, so insert the question_sessions + $newid = insert_record ("question_sessions",$session); } diff --git a/mod/quiz/review.php b/mod/quiz/review.php index c41f64de48a..2ade7ebbb63 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -31,7 +31,7 @@ error("The course module for the quiz with id $quiz->id is missing"); } - if (!count_records('quiz_newest_states', 'attemptid', $attempt->uniqueid)) { + if (!count_records('question_sessions', 'attemptid', $attempt->uniqueid)) { // this question has not yet been upgraded to the new model quiz_upgrade_states($attempt); } diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index cc35236c249..d0f357fa1da 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -31,7 +31,7 @@ if (! $attempt = get_record('quiz_attempts', 'id', $attemptid)) { error('No such attempt ID exists'); } - if (! $neweststateid = get_field('quiz_newest_states', 'newest', 'attemptid', $attempt->uniqueid, 'questionid', $questionid)) { + if (! $neweststateid = get_field('question_sessions', 'newest', 'attemptid', $attempt->uniqueid, 'questionid', $questionid)) { // newest_state not set, probably because this is an old attempt from the old quiz module code if (! $state = get_record('quiz_states', 'question', $questionid, 'attempt', $attempt->uniqueid)) { error('Invalid question id'); diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 8cb9651af63..65819d05e71 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -5,7 +5,7 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006021500; // The (date) version of this module +$module->version = 2006021501; // The (date) version of this module $module->requires = 2005021600; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 0cf3b7ce9cb..5bf395edb66 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -217,7 +217,6 @@ $datecompleted = userdate($attempt->timefinish); } else if ($available) { // The student can continue this attempt, so put appropriate link $timetaken = format_time(time() - $attempt->timestart); - $strconfirmstartattempt = addslashes(get_string("confirmstartattempt","quiz")); $datecompleted = "\n".'