}
}
+ if ($oldversion < 2003111100) {
+ $duplicates = get_records_sql("SELECT stamp as id,count(*) as cuenta
+ FROM {$CFG->prefix}quiz_questions
+ GROUP BY stamp
+ HAVING count(*)>1");
+
+ if ($duplicates) {
+ notify("You have some quiz questions with duplicate stamps IDs. Cleaning these up.");
+ foreach ($duplicates as $duplicate) {
+ $questions = get_records("quiz_questions","stamp",$duplicate->id);
+ $add = 1;
+ foreach ($questions as $question) {
+ echo "Changing question id $question->id stamp to ".$duplicate->id.$add."<br>";
+ set_field("quiz_questions","stamp",$duplicate->id.$add,"id",$question->id);
+ $add++;
+ }
+ }
+ } else {
+ notify("Checked your quiz questions for stamp duplication errors, but no problems were found.", "green");
+ }
+ }
+
return true;
}
}
}
+ if ($oldversion < 2003111100) {
+ $duplicates = get_records_sql("SELECT stamp as id,count(*) as cuenta
+ FROM {$CFG->prefix}quiz_questions
+ GROUP BY stamp
+ HAVING count(*)>1");
+
+ if ($duplicates) {
+ notify("You have some quiz questions with duplicate stamps IDs. Cleaning these up.");
+ foreach ($duplicates as $duplicate) {
+ $questions = get_records("quiz_questions","stamp",$duplicate->id);
+ $add = 1;
+ foreach ($questions as $question) {
+ echo "Changing question id $question->id stamp to ".$duplicate->id.$add."<br>";
+ set_field("quiz_questions","stamp",$duplicate->id.$add,"id",$question->id);
+ $add++;
+ }
+ }
+ } else {
+ notify("Checked your quiz questions for stamp duplication errors, but no problems were found.", "green");
+ }
+ }
+
return true;
}
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003082700; // The (date) version of this module
+$module->version = 2003111100; // The (date) version of this module
$module->cron = 0; // How often should cron check this module (seconds)?
?>
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
-$version = 2003110400; // The current version is a date (YYYYMMDDXX)
+$version = 2003111100; // The current version is a date (YYYYMMDDXX)
$release = "1.2 development"; // User-friendly version number