diff --git a/lib.php b/lib.php index adf9cc5..9beb7f8 100644 --- a/lib.php +++ b/lib.php @@ -875,7 +875,7 @@ function ouwiki_get_post_actions() { function ouwiki_get_coursemodule_info($coursemodule) { global $DB; $ouwiki = $DB->get_record('ouwiki', - ['id' => $coursemodule->instance], 'id, name, completionpages, completionedits'); + ['id' => $coursemodule->instance], 'id, name, completionpages, completionedits, intro, introformat'); if (!$ouwiki) { return null; } @@ -889,6 +889,10 @@ function ouwiki_get_coursemodule_info($coursemodule) { $info->customdata->customcompletionrules['completionedits'] = $ouwiki->completionedits; } + if ($coursemodule->showdescription) { + $info->content = format_module_intro('ouwiki', $ouwiki, $coursemodule->id, false); + } + return $info; } diff --git a/locallib.php b/locallib.php index c202397..fefb04e 100644 --- a/locallib.php +++ b/locallib.php @@ -4058,7 +4058,7 @@ function ouwiki_get_completion_state_lib($cm, $userid, $type) { if ($ouwiki->completionpages) { $value = $ouwiki->completionpages <= $DB->get_field_sql($countsql . - ' AND (SELECT MIN (id) + ' AND (SELECT MIN(id) FROM {ouwiki_versions} WHERE pageid = p.id AND deletedat IS NULL) = v.id', [$userid, $ouwiki->id]); diff --git a/tests/behat/basic.feature b/tests/behat/basic.feature index f4c54f0..57672c7 100644 --- a/tests/behat/basic.feature +++ b/tests/behat/basic.feature @@ -779,3 +779,24 @@ Feature: Test Post and Comment on OUwiki entry And I press "Save changes" When I am on "Course 2" course homepage Then I should see "100%" + + Scenario: Check description on course page + Given the following "activity" exists: + | activity | ouwiki | + | course | C1 | + | name | W.WC | + | intro | Test wiki desc show | + | showdescription | 1 | + | groupmode | 0 | + | section | 1 | + And the following "activity" exists: + | activity | ouwiki | + | course | C1 | + | name | W.WC2 | + | intro | Test wiki no show | + | showdescription | 0 | + | groupmode | 0 | + | section | 1 | + When I am on the "Course 1" "course" page logged in as "teacher1" + Then I should see "Test wiki desc show" + And I should not see "Test wiki no show"