Skip to content

Commit

Permalink
Make the report work with random and fileresponse, too.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed May 28, 2020
1 parent 5833b4c commit 330541d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function display($quiz, $cm, $course) {
$hasessayquestions = false;
if ($questions) {
foreach ($questions as $question) {
if ($question->qtype == 'essay') {
if ($question->qtype == 'essay' || $question->qtype == 'random' || $question->qtype == 'fileresponse') {
$hasessayquestions = true;
break;
}
Expand Down Expand Up @@ -165,7 +165,7 @@ public function quiz_has_essay_questions($quizid) {
JOIN {quiz_slots} slot ON slot.questionid = q.id
WHERE q.qtype = 'essay'
OR q.qtype = 'fileresponse'
ORDER BY slot.slot", array($quiz->id));
}

Expand Down Expand Up @@ -267,7 +267,8 @@ protected function download_essay_submissions($quiz, $cm, $course, $student_atte
$qa = $quba->get_question_attempt($student->slot);
$quba_contextid = $quba->get_owning_context()->id;

if ($qa->get_question()->get_type_name() == 'essay') {
if (($qa->get_question()->get_type_name() == 'essay') OR
($qa->get_question()->get_type_name() == 'fileresponse')) {
$questionname = $qa->get_question()->name;
$prefix1 .= ' - ' . $questionname;

Expand Down Expand Up @@ -448,4 +449,4 @@ public function pack_files($filesforzipping) {
}
return false;
}
}
}

3 comments on commit 330541d

@jondo
Copy link

@jondo jondo commented on 330541d Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Luca, thank you for implementing this! I also need this. Would you mind creating an upstream pull request for it, as you did for some of your other changes?

@lucaboesch
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that fileresponse question type is a not very published one. https://github.com/bfh/moodle-qtype_fileresponse
I prefer to pass this and cherry pick this one to our own deployment only if you don't mind.
Thanks for your kind note!

@jondo
Copy link

@jondo jondo commented on 330541d Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thank you for the explanation! I mistook the fileresponse question type with file responses to an essay question.

Please sign in to comment.