Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 19728815 authored by Astor Bizard's avatar Astor Bizard
Browse files

Added correctness on report.

parent a9626306
......@@ -73,6 +73,7 @@ class quiz_certainty_table extends quiz_attempts_report_table {
$datafields = array(
'question' => 'questionsummary',
'response' => 'responsesummary',
'correctness' => 'correctness',
'certainty' => '-certainty',
'studentfeedback' => '-_studentfeedback',
'generalstudentfeedback' => '-_generalstudentfeedback'
......@@ -82,10 +83,11 @@ class quiz_certainty_table extends quiz_attempts_report_table {
$matches = array();
if (preg_match('/^' . $datafield . '(\d+)$/', $column, $matches)) {
// This column is a data column.
if ($attempt->usageid == 0 || !isset($this->lateststeps[$attempt->usageid][$matches[1]])) {
$slot = $matches[1];
if ($attempt->usageid == 0 || !isset($this->lateststeps[$attempt->usageid][$slot])) {
return '-'; // No data available.
} else {
$stepdata = $this->lateststeps[$attempt->usageid][$matches[1]];
$stepdata = $this->lateststeps[$attempt->usageid][$slot];
return $this->process_data_column($stepdata, $attemptfield);
}
}
......@@ -103,6 +105,8 @@ class quiz_certainty_table extends quiz_attempts_report_table {
public function process_data_column($stepdata, $field) {
global $DB;
$icon = '';
$doformat = (!$this->is_downloading() || $this->is_downloading() == 'html');
if (substr($field, 0, 1) == '-') { // It is a behaviour var.
$behaviourvar = $field;
// Retrieve all steps data for this behaviour var, to get the last one.
......@@ -123,12 +127,16 @@ class quiz_certainty_table extends quiz_attempts_report_table {
if ($behaviourvar == '-certainty' && $lastvar != '-') {
// Format certainty to a readable name.
require_once(__DIR__ . '/../../../../question/behaviour/certaintywithstudentfeedback/behaviourtype.php');
$certaintyname = qbehaviour_certaintywithstudentfeedback_type::$certaintylevels[$lastvar]['name'];
$value = get_string($certaintyname, 'qbehaviour_certaintywithstudentfeedback');
$certainty = qbehaviour_certaintywithstudentfeedback_type::$certaintylevels[$lastvar];
$value = $certainty['percentage'] . ' (' . get_string($certainty['name'], 'qbehaviour_certaintywithstudentfeedback') . ')';
$doformat = false;
} else {
$value = $lastvar;
}
} else if ($field == 'correctness') {
$icon = $this->icon_for_fraction($stepdata->fraction);
$value = get_string(question_state::graded_state_for_fraction($stepdata->fraction)->get_feedback_class(), 'question');
} else {
// This is a step data field, use it as-is.
$value = $stepdata->$field;
......@@ -139,11 +147,11 @@ class quiz_certainty_table extends quiz_attempts_report_table {
$value = trim($value);
if ($this->is_downloading() && $this->is_downloading() != 'html') {
return $value;
} else {
return s($value);
if ($doformat) {
$value = s($value);
}
return $icon . $value;
}
/**
......
......@@ -27,6 +27,7 @@ $string['certainty'] = 'Certainty export';
$string['certaintyfilename'] = 'certainty';
$string['certaintyreport'] = 'Certainty report';
$string['certaintyx'] = 'Certainty {$a}';
$string['correctnessx'] = 'Correctness {$a}';
$string['generalstudentfeedback'] = 'General student feedback';
$string['incompatiblebehaviour'] = 'This report is only compatible with the Certainty with student feedback behaviour.';
$string['responsex'] = 'Response {$a}';
......
......@@ -154,6 +154,8 @@ class quiz_certainty_report extends quiz_attempts_report {
$headers[] = get_string('questionx', 'question', $question->number);
$columns[] = 'response' . $id;
$headers[] = get_string('responsex', 'quiz_certainty', $question->number);
$columns[] = 'correctness' . $id;
$headers[] = get_string('correctnessx', 'quiz_certainty', $question->number);
$columns[] = 'certainty' . $id;
$headers[] = get_string('certaintyx', 'quiz_certainty', $question->number);
$columns[] = 'studentfeedback' . $id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment