Skip to content

Commit

Permalink
StudentQuiz: Display description on course page
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuvu authored and AnupamaSarjoshi committed Jan 14, 2025
1 parent 228442d commit ca9d9c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,18 @@ function studentquiz_get_coursemodule_info(stdClass $coursemodule): cached_cm_in

$studentquiz = $DB->get_record('studentquiz',
['id' => $coursemodule->instance], 'id, name, completionpoint, completionquestionpublished,
completionquestionapproved');
intro, introformat, completionquestionapproved');
if (!$studentquiz) {
return false;
}

$info = new cached_cm_info();
$info->customdata = (object) [];

if ($coursemodule->showdescription) {
// Convert intro to html. Do not filter cached version, filters run at display time.
$info->content = format_module_intro('studentquiz', $studentquiz, $coursemodule->id, false);
}
// Populate the custom completion rules as key => value pairs, but only if the completion mode is 'automatic'.
if ($coursemodule->completion == COMPLETION_TRACKING_AUTOMATIC) {
$info->customdata->customcompletionrules['completionpoint'] = $studentquiz->completionpoint;
Expand Down
6 changes: 4 additions & 2 deletions tests/behat/add_studentquiz.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ Feature: Activities can be created
@javascript
Scenario: Check an Activity can be created
When I add a studentquiz activity to course "Course 1" section "1" and I fill the form with:
| StudentQuiz Name | Test quiz name |
| Description | Test quiz description |
| StudentQuiz Name | Test quiz name |
| Description | Test quiz description |
| Display description on course page | 1 |
And I should see "Test quiz description"
And I am on the "Test quiz name" "mod_studentquiz > View" page
Then I should see "Create new question"

Expand Down

0 comments on commit ca9d9c9

Please sign in to comment.