Admin: Add configuration setting 'quiz_answer_extra_recording' to use track_e_attempt_recording to store all answer attempts (even temporary) and improve audit capabilities for exams - refs #3249

pull/3250/head
Yannick Warnier 5 years ago
parent 055a19baff
commit 6417aebcd6
  1. 9
      main/inc/lib/events.lib.php
  2. 5
      main/install/configuration.dist.php

@ -543,6 +543,7 @@ class Event
$position = Database::escape_string($position);
$now = api_get_utc_datetime();
$course_id = (int) $course_id;
$recording = api_get_configuration_value('quiz_answer_extra_recording') == true;
// check user_id or get from context
if (empty($user_id)) {
@ -648,16 +649,16 @@ class Event
error_log("Insert attempt with id #$attempt_id");
}
if (defined('ENABLED_LIVE_EXERCISE_TRACKING')) {
if ($recording) {
if ($debug) {
error_log("Saving e attempt recording ");
}
$attempt_recording = [
'exe_id' => $attempt_id,
'question_id' => $question_id,
'answer' => $answer,
'marks' => $score,
'insert_date' => $now,
'author' => '',
'session_id' => $session_id,
];
Database::insert($recording_table, $attempt_recording);
@ -675,13 +676,13 @@ class Event
]
);
if (defined('ENABLED_LIVE_EXERCISE_TRACKING')) {
if ($recording) {
$attempt_recording = [
'exe_id' => $exe_id,
'question_id' => $question_id,
'answer' => $answer,
'marks' => $score,
'insert_date' => $now,
'author' => '',
'session_id' => $session_id,
];

@ -1515,6 +1515,11 @@ $_configuration['auth_password_links'] = [
// ALTER TABLE c_lp_category ADD COLUMN session_id INT(11) DEFAULT NULL;
//$_configuration['allow_session_lp_category'] = false;
// Enable recording of all answers (even temporary) in the track_e_attempt_recording table
// This requires a column to be added to the table with the following query:
// ALTER TABLE track_e_attempt_recording ADD COLUMN answer longtext default '' AFTER question_id;
//$_configuration['quiz_answer_extra_recording'] = false;
// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email

Loading…
Cancel
Save