From ea003cd59a37fc063bf9e3b5f8cc970f4ab08fec Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 17 Mar 2011 10:38:51 +0000 Subject: [PATCH] MDL-26848 get rid of stupid unsigned columns in the quiz statistics report. --- mod/quiz/report/statistics/db/install.xml | 22 ++++---- mod/quiz/report/statistics/db/upgrade.php | 68 +++++++++++++++++++++++ mod/quiz/report/statistics/version.php | 2 +- 3 files changed, 80 insertions(+), 12 deletions(-) diff --git a/mod/quiz/report/statistics/db/install.xml b/mod/quiz/report/statistics/db/install.xml index 700023aba31..b44b0ebd0f9 100644 --- a/mod/quiz/report/statistics/db/install.xml +++ b/mod/quiz/report/statistics/db/install.xml @@ -13,15 +13,15 @@ - - - - + + + + - - + + @@ -34,14 +34,14 @@ - + - - + + - + @@ -57,7 +57,7 @@ - + diff --git a/mod/quiz/report/statistics/db/upgrade.php b/mod/quiz/report/statistics/db/upgrade.php index 0d6795d7c58..f4e4764b12d 100644 --- a/mod/quiz/report/statistics/db/upgrade.php +++ b/mod/quiz/report/statistics/db/upgrade.php @@ -160,6 +160,74 @@ function xmldb_quiz_statistics_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2008112100, 'quizreport', 'statistics'); } + if ($oldversion < 2008112101) { + // Removed stupid UNSIGNED from all NUMBER columns in the quiz_statistics table. + $table = new xmldb_table('quiz_statistics'); + + // Change of sign for field firstattemptsavg + $field = new xmldb_field('firstattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'allattemptscount'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field allattemptsavg + $field = new xmldb_field('allattemptsavg', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'firstattemptsavg'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field median + $field = new xmldb_field('median', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'allattemptsavg'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field standarddeviation + $field = new xmldb_field('standarddeviation', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'median'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field errorratio + $field = new xmldb_field('errorratio', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'cic'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field standarderror + $field = new xmldb_field('standarderror', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'errorratio'); + $dbman->change_field_unsigned($table, $field); + + // statistics savepoint reached + upgrade_plugin_savepoint(true, 2008112101, 'quiz', 'statistics'); + } + + if ($oldversion < 2008112102) { + // Removed stupid UNSIGNED from all NUMBER columns in the quiz_question_statistics table. + $table = new xmldb_table('quiz_question_statistics'); + + // Change of sign for field effectiveweight + $field = new xmldb_field('effectiveweight', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 's'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field sd + $field = new xmldb_field('sd', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'discriminativeefficiency'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field facility + $field = new xmldb_field('facility', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null, 'sd'); + $dbman->change_field_unsigned($table, $field); + + // Change of sign for field maxgrade + $field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'subquestions'); + $dbman->change_field_unsigned($table, $field); + + // statistics savepoint reached + upgrade_plugin_savepoint(true, 2008112102, 'quiz', 'statistics'); + } + + if ($oldversion < 2008112103) { + // Removed stupid UNSIGNED from all NUMBER columns in the quiz_question_response_stats table. + $table = new xmldb_table('quiz_question_response_stats'); + + // Change of sign for field credit + $field = new xmldb_field('credit', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null, 'rcount'); + $dbman->change_field_unsigned($table, $field); + + // statistics savepoint reached + upgrade_plugin_savepoint(true, 2008112103, 'quiz', 'statistics'); + } + return true; } diff --git a/mod/quiz/report/statistics/version.php b/mod/quiz/report/statistics/version.php index 8d23da59eae..464cbbe3ebe 100644 --- a/mod/quiz/report/statistics/version.php +++ b/mod/quiz/report/statistics/version.php @@ -1,2 +1,2 @@ version = 2008112100; // The (date) version of this module +$plugin->version = 2008112103; // The (date) version of this module