Commit 04853f27 authored by Tim Hunt's avatar Tim Hunt
Browse files

MDL-20636 Convert quiz statistics report.

parent 9b40c540
<?php <?php
function quiz_report_statistics_cron(){
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Quiz statistics report cron code.
*
* @package quiz
* @subpackage statistics
* @copyright 2008 Jamie Pratt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once($CFG->dirroot . '/question/engine/compatibility.php');
/**
* Quiz statistics report cron code. Deletes cached data more than a certain age.
*/
function quiz_report_statistics_cron() {
global $DB; global $DB;
if ($todelete = $DB->get_records_select_menu('quiz_statistics', 'timemodified < ?', array(time()-5*HOURSECS))){
list($todeletesql, $todeleteparams) = $DB->get_in_or_equal(array_keys($todelete)); $expiretime = time() - 5*HOURSECS;
if (!$DB->delete_records_select('quiz_statistics', "id $todeletesql", $todeleteparams)){ $todelete = $DB->get_records_select_menu('quiz_statistics', 'timemodified < ?', array($expiretime), '', 'id,1');
mtrace('Error deleting out of date quiz_statistics records.');
} if (!$todelete) {
if (!$DB->delete_records_select('quiz_question_statistics', "quizstatisticsid $todeletesql", $todeleteparams)){ return true;
mtrace('Error deleting out of date quiz_question_statistics records.');
}
} }
list($todeletesql, $todeleteparams) = $DB->get_in_or_equal(array_keys($todelete));
if (!$DB->delete_records_select('quiz_question_statistics', 'quizstatisticsid ' . $todeletesql, $todeleteparams)){
mtrace('Error deleting out of date quiz_question_statistics records.');
}
if (!$DB->delete_records_select('quiz_question_response_stats', 'quizstatisticsid ' . $todeletesql, $todeleteparams)) {
mtrace('Error deleting out of date quiz_question_response_stats records.');
}
if (!$DB->delete_records_select('quiz_statistics', 'id ' . $todeletesql, $todeleteparams)){
mtrace('Error deleting out of date quiz_statistics records.');
}
return true; return true;
} }
<?php <?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/** /**
* Capability definitions for the quiz statistics report. * Capability definitions for the quiz statistics report.
* *
* For naming conventions, see lib/db/access.php. * @package quiz
* @subpackage statistics
* @copyright 2008 Jamie Pratt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
$capabilities = array( $capabilities = array(
'quizreport/statistics:view' => array( 'quiz/statistics:view' => array(
'captype' => 'read', 'captype' => 'read',
'contextlevel' => CONTEXT_MODULE, 'contextlevel' => CONTEXT_MODULE,
'archetypes' => array( 'archetypes' => array(
......
<?php <?php
// This file is executed right after the install.xml // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Post-install script for the quiz statistics report.
* @package quiz
* @subpackage statistics
* @copyright 2010 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Post-install script
*/
function xmldb_quiz_statistics_install() { function xmldb_quiz_statistics_install() {
global $DB; global $DB;
...@@ -10,7 +34,6 @@ function xmldb_quiz_statistics_install() { ...@@ -10,7 +34,6 @@ function xmldb_quiz_statistics_install() {
$record->name = 'statistics'; $record->name = 'statistics';
$record->displayorder = 8000; $record->displayorder = 8000;
$record->cron = 18000; $record->cron = 18000;
$record->capability = 'quizreport/statistics:view'; $record->capability = 'quiz/statistics:view';
$DB->insert_record('quiz_report', $record); $DB->insert_record('quiz_reports', $record);
}
}
\ No newline at end of file
...@@ -31,8 +31,9 @@ ...@@ -31,8 +31,9 @@
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="quizstatisticsid"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="quizstatisticsid"/>
<FIELD NAME="quizstatisticsid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="questionid"/> <FIELD NAME="quizstatisticsid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="questionid"/>
<FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="quizstatisticsid" NEXT="subquestion"/> <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="quizstatisticsid" NEXT="slot"/>
<FIELD NAME="subquestion" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="questionid" NEXT="s"/> <FIELD NAME="slot" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="The position in the quiz where this question appears" PREVIOUS="questionid" NEXT="subquestion"/>
<FIELD NAME="subquestion" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="slot" NEXT="s"/>
<FIELD NAME="s" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="subquestion" NEXT="effectiveweight"/> <FIELD NAME="s" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="subquestion" NEXT="effectiveweight"/>
<FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="s" NEXT="negcovar"/> <FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="s" NEXT="negcovar"/>
<FIELD NAME="negcovar" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="effectiveweight" NEXT="discriminationindex"/> <FIELD NAME="negcovar" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="effectiveweight" NEXT="discriminationindex"/>
...@@ -40,9 +41,10 @@ ...@@ -40,9 +41,10 @@
<FIELD NAME="discriminativeefficiency" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="discriminationindex" NEXT="sd"/> <FIELD NAME="discriminativeefficiency" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="5" PREVIOUS="discriminationindex" NEXT="sd"/>
<FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="discriminativeefficiency" NEXT="facility"/> <FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="discriminativeefficiency" NEXT="facility"/>
<FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="sd" NEXT="subquestions"/> <FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="10" PREVIOUS="sd" NEXT="subquestions"/>
<FIELD NAME="subquestions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" PREVIOUS="facility" NEXT="maxgrade"/> <FIELD NAME="subquestions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" PREVIOUS="facility" NEXT="maxmark"/>
<FIELD NAME="maxgrade" TYPE="number" LENGTH="12" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="7" PREVIOUS="subquestions" NEXT="positions"/> <FIELD NAME="maxmark" TYPE="number" LENGTH="12" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="7" PREVIOUS="subquestions" NEXT="positions"/>
<FIELD NAME="positions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" COMMENT="positions in which this item appears. Only used for random questions." PREVIOUS="maxgrade"/> <FIELD NAME="positions" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" COMMENT="positions in which this item appears. Only used for random questions." PREVIOUS="maxmark" NEXT="randomguessscore"/>
<FIELD NAME="randomguessscore" TYPE="number" LENGTH="12" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" DECIMALS="7" COMMENT="An estimate of the score a student would get by guessing randomly." PREVIOUS="positions"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
...@@ -54,7 +56,7 @@ ...@@ -54,7 +56,7 @@
<FIELD NAME="quizstatisticsid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="questionid"/> <FIELD NAME="quizstatisticsid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="questionid"/>
<FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="quizstatisticsid" NEXT="subqid"/> <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="quizstatisticsid" NEXT="subqid"/>
<FIELD NAME="subqid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="questionid" NEXT="aid"/> <FIELD NAME="subqid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="questionid" NEXT="aid"/>
<FIELD NAME="aid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="subqid" NEXT="response"/> <FIELD NAME="aid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="subqid" NEXT="response"/>
<FIELD NAME="response" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" PREVIOUS="aid" NEXT="rcount"/> <FIELD NAME="response" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" PREVIOUS="aid" NEXT="rcount"/>
<FIELD NAME="rcount" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="response" NEXT="credit"/> <FIELD NAME="rcount" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="response" NEXT="credit"/>
<FIELD NAME="credit" TYPE="number" LENGTH="15" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="rcount"/> <FIELD NAME="credit" TYPE="number" LENGTH="15" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" PREVIOUS="rcount"/>
......
<?php <?php
// This file keeps track of upgrades to
// the quiz statistics report.
//
// Sometimes, changes between versions involve
// alterations to database structures and other
// major things that may break installations.
//
// The upgrade function in this file will attempt
// to perform all the necessary actions to upgrade
// your older installtion to the current version.
//
// If there's something it cannot do itself, it
// will tell you what you need to do.
//
// The commands in here will all be database-neutral,
// using the functions defined in lib/ddllib.php
/**
* Post-install script for the quiz statistics report.
* @package quiz
* @subpackage statistics
* @copyright 2008 Jamie Pratt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Quiz statistics report upgrade code.
*/
function xmldb_quiz_statistics_upgrade($oldversion) { function xmldb_quiz_statistics_upgrade($oldversion) {
global $DB; global $DB;
...@@ -13,7 +42,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -13,7 +42,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
$DB->set_field('quiz_report', 'cron', HOURSECS*5, array('name'=>'statistics')); $DB->set_field('quiz_report', 'cron', HOURSECS*5, array('name'=>'statistics'));
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008072401, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008072401, 'quiz', 'statistics');
} }
if ($oldversion < 2008072500) { if ($oldversion < 2008072500) {
...@@ -28,7 +57,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -28,7 +57,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
} }
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008072500, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008072500, 'quiz', 'statistics');
} }
if ($oldversion < 2008072800) { if ($oldversion < 2008072800) {
...@@ -43,7 +72,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -43,7 +72,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
} }
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008072800, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008072800, 'quiz', 'statistics');
} }
if ($oldversion < 2008072801) { if ($oldversion < 2008072801) {
...@@ -58,7 +87,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -58,7 +87,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
} }
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008072801, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008072801, 'quiz', 'statistics');
} }
if ($oldversion < 2008081500) { if ($oldversion < 2008081500) {
...@@ -70,7 +99,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -70,7 +99,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
$dbman->change_field_type($table, $field); $dbman->change_field_type($table, $field);
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008081500, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008081500, 'quiz', 'statistics');
} }
if ($oldversion < 2008082600) { if ($oldversion < 2008082600) {
...@@ -96,7 +125,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -96,7 +125,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
} }
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008082600, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008082600, 'quiz', 'statistics');
} }
if ($oldversion < 2008090500) { if ($oldversion < 2008090500) {
...@@ -130,7 +159,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -130,7 +159,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
} }
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008090500, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008090500, 'quiz', 'statistics');
} }
if ($oldversion < 2008111000) { if ($oldversion < 2008111000) {
...@@ -150,14 +179,96 @@ function xmldb_quiz_statistics_upgrade($oldversion) { ...@@ -150,14 +179,96 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
} }
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008111000, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008111000, 'quiz', 'statistics');
} }
if ($oldversion < 2008112100) { if ($oldversion < 2008112100) {
$DB->set_field('quiz_report', 'capability', 'quizreport/statistics:view', array('name'=>'statistics')); $DB->set_field('quiz_report', 'capability', 'quizreport/statistics:view', array('name'=>'statistics'));
/// statistics savepoint reached /// statistics savepoint reached
upgrade_plugin_savepoint(true, 2008112100, 'quizreport', 'statistics'); upgrade_plugin_savepoint(true, 2008112100, 'quiz', 'statistics');
}
if ($oldversion < 2010031700) {
// Define field randomguessscore to be added to quiz_question_statistics
$table = new xmldb_table('quiz_question_statistics');
$field = new xmldb_field('randomguessscore', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'positions');
// Conditionally launch add field randomguessscore
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2010031700, 'quiz', 'statistics');
}
if ($oldversion < 2010032400) {
// Define field slot to be added to quiz_question_statistics
$table = new xmldb_table('quiz_question_statistics');
$field = new xmldb_field('slot', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, 'questionid');
// Conditionally launch add field slot
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2010032400, 'quiz', 'statistics');
}
if ($oldversion < 2010032401) {
/// Delete all cached data
$DB->delete_records('quiz_question_response_stats');
$DB->delete_records('quiz_question_statistics');
$DB->delete_records('quiz_statistics');
// Rename field maxgrade on table quiz_question_statistics to maxmark
$table = new xmldb_table('quiz_question_statistics');
$field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, null, null, null, 'subquestions');
// Launch rename field maxmark
$dbman->rename_field($table, $field, 'maxmark');
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2010032401, 'quiz', 'statistics');
}
if ($oldversion < 2010062200) {
// Changing nullability of field aid on table quiz_question_response_stats to null
$table = new xmldb_table('quiz_question_response_stats');
$field = new xmldb_field('aid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, 'subqid');
// Launch change of nullability for field aid
$dbman->change_field_notnull($table, $field);
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2010062200, 'quiz', 'statistics');
}
if ($oldversion < 2010070301) {
// Changing type of field maxmark on table quiz_question_statistics to number
$table = new xmldb_table('quiz_question_statistics');
$field = new xmldb_field('maxmark', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, null, null, null, 'subquestions');
// Launch change of type for field maxmark
$dbman->change_field_type($table, $field);
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2010070301, 'quiz', 'statistics');
}
if ($oldversion < 2011021500) {
$DB->set_field('quiz_reports', 'capability', 'quiz/statistics:view',
array('name' => 'statistics'));
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2011021500, 'quiz', 'statistics');
} }
return true; return true;
......
...@@ -23,9 +23,11 @@ ...@@ -23,9 +23,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
$string['actualresponse'] = 'Actual response';
$string['allattempts'] = 'all attempts'; $string['allattempts'] = 'all attempts';
$string['allattemptsavg'] = 'Average grade of all attempts'; $string['allattemptsavg'] = 'Average grade of all attempts';
$string['allattemptscount'] = 'Total number of attempts'; $string['allattemptscount'] = 'Total number of complete graded attempts';
$string['analysisofresponses'] = 'Analysis of responses'; $string['analysisofresponses'] = 'Analysis of responses';
$string['analysisofresponsesfor'] = 'Analysis of responses for {$a}.'; $string['analysisofresponsesfor'] = 'Analysis of responses for {$a}.';
$string['attempts'] = 'Attempts'; $string['attempts'] = 'Attempts';
...@@ -34,6 +36,7 @@ $string['attemptsfirst'] = 'first attempt'; ...@@ -34,6 +36,7 @@ $string['attemptsfirst'] = 'first attempt';
$string['backtoquizreport'] = 'Back to main statistics report page.'; $string['backtoquizreport'] = 'Back to main statistics report page.';
$string['calculatefrom'] = 'Calculate statistics from'; $string['calculatefrom'] = 'Calculate statistics from';
$string['cic'] = 'Coefficient of internal consistency (for {$a})'; $string['cic'] = 'Coefficient of internal consistency (for {$a})';
$string['completestatsfilename'] = 'completestats';
$string['count'] = 'Count'; $string['count'] = 'Count';
$string['coursename'] = 'Course name'; $string['coursename'] = 'Course name';
$string['detailedanalysis'] = 'More detailed analysis of the responses to this question'; $string['detailedanalysis'] = 'More detailed analysis of the responses to this question';
...@@ -53,12 +56,13 @@ $string['errorstatisticsquestions'] = 'Error fetching data to calculate statisti ...@@ -53,12 +56,13 @@ $string['errorstatisticsquestions'] = 'Error fetching data to calculate statisti
$string['facility'] = 'Facility index'; $string['facility'] = 'Facility index';
$string['firstattempts'] = 'first attempts'; $string['firstattempts'] = 'first attempts';
$string['firstattemptsavg'] = 'Average grade of first attempts'; $string['firstattemptsavg'] = 'Average grade of first attempts';
$string['firstattemptscount'] = 'Number of first attempts'; $string['firstattemptscount'] = 'Number of complete graded first attempts';
$string['frequency'] = 'Frequency'; $string['frequency'] = 'Frequency';
$string['intended_weight'] = 'Intended weight'; $string['intended_weight'] = 'Intended weight';
$string['kurtosis'] = 'Score distribution kurtosis (for {$a})'; $string['kurtosis'] = 'Score distribution kurtosis (for {$a})';
$string['lastcalculated'] = 'Last calculated {$a->lastcalculated} ago there have been {$a->count} attempts since then.'; $string['lastcalculated'] = 'Last calculated {$a->lastcalculated} ago there have been {$a->count} attempts since then.';
$string['median'] = 'Median grade (for {$a})'; $string['median'] = 'Median grade (for {$a})';
$string['modelresponse'] = 'Model response';
$string['negcovar'] = 'Negative covariance of grade with total attempt grade'; $string['negcovar'] = 'Negative covariance of grade with total attempt grade';
$string['negcovar_help'] = 'This question\'s grade for this set of attempts on the quiz varies in an opposite way to the overall attempt grade. This means overall attempt grade tends to be below average when the grade for this question is above average and vice-versa. $string['negcovar_help'] = 'This question\'s grade for this set of attempts on the quiz varies in an opposite way to the overall attempt grade. This means overall attempt grade tends to be below average when the grade for this question is above average and vice-versa.
...@@ -73,6 +77,7 @@ $string['questioninformation'] = 'Question information'; ...@@ -73,6 +77,7 @@ $string['questioninformation'] = 'Question information';
$string['questionname'] = 'Question name'; $string['questionname'] = 'Question name';
$string['questionnumber'] = 'Q#'; $string['questionnumber'] = 'Q#';
$string['questionstatistics'] = 'Question statistics'; $string['questionstatistics'] = 'Question statistics';
$string['questionstatsfilename'] = 'questionstats';
$string['questiontype'] = 'Question type'; $string['questiontype'] = 'Question type';
$string['quizinformation'] = 'Quiz information'; $string['quizinformation'] = 'Quiz information';
$string['quizname'] = 'Quiz name'; $string['quizname'] = 'Quiz name';
...@@ -80,7 +85,7 @@ $string['quizoverallstatistics'] = 'Quiz overall statistics'; ...@@ -80,7 +85,7 @@ $string['quizoverallstatistics'] = 'Quiz overall statistics';
$string['quizstructureanalysis'] = 'Quiz structure analysis'; $string['quizstructureanalysis'] = 'Quiz structure analysis';
$string['random_guess_score'] = 'Random guess score'; $string['random_guess_score'] = 'Random guess score';
$string['recalculatenow'] = 'Recalculate now'; $string['recalculatenow'] = 'Recalculate now';
$string['response'] = 'Answer'; $string['response'] = 'Response';
$string['skewness'] = 'Score distribution skewness (for {$a})'; $string['skewness'] = 'Score distribution skewness (for {$a})';
$string['standarddeviation'] = 'Standard deviation (for {$a})'; $string['standarddeviation'] = 'Standard deviation (for {$a})';
$string['standarddeviationq'] = 'Standard deviation'; $string['standarddeviationq'] = 'Standard deviation';
......
This diff is collapsed.
This diff is collapsed.
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains the code to analyse all the responses to a particular
* question.
*
* @package quiz_statistics
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class can store and compute the analysis of the responses to a particular
* question.
*
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class quiz_statistics_response_analyser {
/** @var object the data from the database that defines the question. */
protected $questiondata;
protected $loaded = false;
/**
* @var array This is a multi-dimensional array that stores the results of
* the analysis.
*
* The description of {@link question_type::get_possible_responses()} should
* help understand this description.
*
* $this->responses[$subpartid][$responseclassid][$response] is an
* object with two fields, ->count and ->fraction.
*/
public $responses = array();
/**
* @var array An array of
* $this->fractions[$subpartid][$responseclassid] is an object with two
* fields, ->responseclass and ->fraction.
*/
public $responseclasses = array();
/**
* Create a new instance of this class for holding/computing the statistics
* for a particular question.
* @param object $questiondata the data from the database defining this question.
*/
public function __construct($questiondata) {
$this->questiondata = $questiondata;