feat: Enhances question detail display in reports

Displays question name and text in report tables to improve
clarity of user responses alongside their grades.

Improves readability and context by enriching question details.
This commit is contained in:
Kumi 2024-11-21 20:54:21 +01:00
parent 77614bc8c3
commit 1dac3d1e99
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -56,7 +56,7 @@ if ($mform->is_cancelled()) {
$attempt_table->head = array(get_string('question', 'report_usergrades'), get_string('response', 'report_usergrades'), get_string('grade', 'report_usergrades'));
$question_usages = $DB->get_records('question_usages', array('id' => $attempt->uniqueid));
foreach ($question_usages as $question_usage) {
$question_attempts = $DB->get_records('question_attempts', array('questionusageid' => $question_usage->id));
@ -68,7 +68,7 @@ if ($mform->is_cancelled()) {
foreach ($question_grades as $question_grade) {
if ($question_grade->fraction) {
$attempt_table->data[] = array($question->name, $response, $question_grade->fraction);
$attempt_table->data[] = array($question->name . ': ' . $question->questiontext, $response, $question_grade->fraction);
}
}
}
@ -79,7 +79,6 @@ if ($mform->is_cancelled()) {
$total_grade = $DB->get_record('quiz_grades', array('quiz' => $quiz->id, 'userid' => $user->id));
echo $OUTPUT->heading(get_string('totalgrade', 'report_usergrades') . ': ' . $total_grade->grade . ' / ' . $quiz->grade, 6);
}
}
}