for teachers to choose number of decimals for calculated questions.
Can someone please check if the database update for postgres7 turns out alright?
fwrite ($bf,full_tag("TOLERANCE",$level+1,false,$calculated->tolerance));
fwrite ($bf,full_tag("TOLERANCETYPE",$level+1,false,$calculated->tolerancetype));
fwrite ($bf,full_tag("CORRECTANSWERLENGTH",$level+1,false,$calculated->correctanswerlength));
+ fwrite ($bf,full_tag("CORRECTANSWERFORMAT",$level+1,false,$calculated->correctanswerformat));
//Now backup numerical_units
$status = quiz_backup_numerical_units($bf,$preferences,$question,7);
//Now backup required dataset definitions and items...
modify_database('','ALTER TABLE prefix_quiz_numerical_units ADD INDEX question (question);');
modify_database('','ALTER TABLE prefix_quiz_questions ADD INDEX category (category);');
}
+
+ if ($oldversion < 2004120501) {
+ table_column("quiz_calculated", "", "correctanswerformat", "integer", "10", "", "2", "not null", "correctanswerlength");
+ }
return true;
}
`tolerance` varchar(20) NOT NULL default '0.0',
`tolerancetype` int(10) NOT NULL default '1',
`correctanswerlength` int(10) NOT NULL default '2',
+ `correctanswerformat` int(10) NOT NULL default '2',
PRIMARY KEY (`id`),
KEY `question` (`question`),
KEY `answer` (`answer`)
modify_database('','ALTER TABLE prefix_quiz_attemptonlast_datasets ADD CONSTRAINT prefix_quiz_category_userid_unique UNIQUE (category,userid);');
}
+ if ($oldversion < 2004120501) {
+ table_column("quiz_calculated", "", "correctanswerformat", "integer", "10", "", "2", "not null", "correctanswerlength");
+ }
+
return true;
}
answer INT8 NOT NULL default '0',
tolerance varchar(20) NOT NULL default '0.0',
tolerancetype INT8 NOT NULL default '1',
- correctanswerlength INT8 NOT NULL default '2'
+ correctanswerlength INT8 NOT NULL default '2',
+ correctanswerformat INT8 NOT NULL default '2'
);
CREATE INDEX prefix_quiz_calculated_question_idx
$calculated->tolerance = backup_todb($cal_info['#']['TOLERANCE']['0']['#']);
$calculated->tolerancetype = backup_todb($cal_info['#']['TOLERANCETYPE']['0']['#']);
$calculated->correctanswerlength = backup_todb($cal_info['#']['CORRECTANSWERLENGTH']['0']['#']);
+ $calculated->correctanswerformat = backup_todb($cal_info['#']['CORRECTANSWERFORMAT']['0']['#']);
////We have to recode the answer field
$answer = backup_getid($restore->backup_unique_code,"quiz_answers",$calculated->answer);
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004112300; // The (date) version of this module
+$module->version = 2004120501; // The (date) version of this module
$module->requires = 2004112300; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?