Skip to content
Permalink
Browse files

Some mysql versions appear not to be willing to convert an empty stri…

…ng into a float. So setting all empty fields to 0 first.
  • Loading branch information...
gustav_delius
gustav_delius committed Feb 22, 2006
1 parent ce5a4f3 commit f7cf31f59451a6b94620ec135c49f8ffcc135904
Showing with 15 additions and 2 deletions.
  1. +14 −1 mod/quiz/db/mysql.php
  2. +1 −1 mod/quiz/version.php
@@ -913,14 +913,27 @@ function quiz_upgrade($oldversion) {
execute_sql("ALTER TABLE {$CFG->prefix}quiz_newest_states RENAME {$CFG->prefix}question_sessions", false);
}
if ($oldversion < 2006021900) {
if ($oldversion < 2006022200) {
// convert grade fields to float
set_field('quiz_attempts', 'sumgrades', 0, 'sumgrades', '');
table_column('quiz_attempts', 'sumgrades', 'sumgrades', 'float', '', '', '0', 'not null');
set_field('quiz_answers', 'fraction', 0, 'fraction', '');
table_column('quiz_answers', 'fraction', 'fraction', 'float', '', '', '0', 'not null');
set_field('quiz_essay_states', 'fraction', 0, 'fraction', '');
table_column('quiz_essay_states', 'fraction', 'fraction', 'float', '', '', '0', 'not null');
set_field('quiz_states', 'grade', 0, 'grade', '');
table_column('quiz_states', 'grade', 'grade', 'float', '', '', '0', 'not null');
set_field('quiz_states', 'raw_grade', 0, 'raw_grade', '');
table_column('quiz_states', 'raw_grade', 'raw_grade', 'float', '', '', '0', 'not null');
set_field('quiz_states', 'penalty', 0, 'penalty', '');
table_column('quiz_states', 'penalty', 'penalty', 'float', '', '', '0', 'not null');
set_field('question_sessions', 'sumpenalty', 0, 'sumpenalty', '');
table_column('question_sessions', 'sumpenalty', 'sumpenalty', 'float', '', '', '0', 'not null');
}
@@ -5,7 +5,7 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2006021900; // The (date) version of this module
$module->version = 2006022200; // The (date) version of this module
$module->requires = 2005101200; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?

0 comments on commit f7cf31f

Please sign in to comment.
You can’t perform that action at this time.