Description won't show on course page

Description won't show on course page

by Marina Tych -
Number of replies: 11

Hello

I have problems displaying description of a particular questionnaire on a course page. Normally when in General settings I tick "Display description on course page" I can see a grey bar with description under the title of any module on a course page (see the screenshot — there I created a sample page module). 

Questionnaire won't show description a course page (where it is most relevant) however I can see it on every page when I follow through the assignment:
— on the starting page
— on every question page
— on "submitted" page
— even on results page

I want my students to learn from the description what the questionnaire is about — this is relevant for the course page. 

Also, brief instruction would be helpful for starting page. Maybe some students will want to reread instructions on questions pages (which I doubt...) But for those who have just completed a questionnaire description/instruction is irrelevant — they now want to see results.

So, my cry for help:

1. Can description for course page be turned on? 
2. Is it possible to have additional field for instructions (other than description) that will be visible while completing a questionnaire ? 

Thanks a lot!

Attachment Quest-descr-problem_01.png
Attachment Quest-descr-problem_02.png
Average of ratings: Useful (1)
In reply to Marina Tych

Re: Description won't show on course page

by Mitsuhiro Yoshida -
Picture of Core developers Picture of Documentation writers Picture of Translators

If you can modify the Questionnaire program file, try the following modifications:

Questionnaire version:
4.0.0 (Build - 2023030700) (2022092201)

Program file to modify:
mod/questionnaire/lib.php

Line:
264

[ Before ]
function questionnaire_get_coursemodule_info($coursemodule) {
    global $DB;

    $questionnaire = $DB->get_record('questionnaire',
        array('id' => $coursemodule->instance), 'id, name, intro, introformat,
             completionsubmit');
    if (!$questionnaire) {
        return null;
    }

    $info = new cached_cm_info();
    $info->customdata = (object)[];
    // 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['completionsubmit'] = $questionnaire->completionsubmit;
    }
    return $info;
}

[ After ]
function questionnaire_get_coursemodule_info($coursemodule) {
    global $DB;

    $questionnaire = $DB->get_record('questionnaire',
        array('id' => $coursemodule->instance), 'id, name, intro, introformat,
             completionsubmit');
    if (!$questionnaire) {
        return null;
    }

    $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.
        // Based on the function quiz_get_coursemodule_info() in the quiz module.
        $info->content = format_module_intro('questionnaire', $questionnaire, $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['completionsubmit'] = $questionnaire->completionsubmit;
    }
    return $info;
}
Average of ratings: Useful (3)
In reply to Mitsuhiro Yoshida

Re: Description won't show on course page

by Marina Tych -

Hello Mitsuhiro,

That code has worked — now I can see description on the course page.

Thank you!

In reply to Marina Tych

Re: Description won't show on course page

by Mitsuhiro Yoshida -
Picture of Core developers Picture of Documentation writers Picture of Translators
I'm glad you were able to resolve it.
In reply to Mitsuhiro Yoshida

Re: Description won't show on course page

by Stefan Schoch -
I had the same problem and could fix it with your advice. Thank you!

Will this be fixed with the next release?
In reply to Mitsuhiro Yoshida

Re: Description won't show on course page

by Mike Churchward -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Could you raise this issue and perhaps provide your code fix as a pull request on Github?
In reply to Mike Churchward

Re: Description won't show on course page

by Lionel Caylat -
Hi,
As no one has reported this problem, I did: https://github.com/PoetOS/moodle-mod_questionnaire/issues/487 (I don't know how to pull a request...)
Hope it gets fixed soon.
Average of ratings: Useful (1)
In reply to Lionel Caylat

Re: Description won't show on course page

by Richard van Iwaarden -
Thanks! I bumped it, as we are running into this problem as well (Moodle 4.2)
In reply to Richard van Iwaarden

Re: Description won't show on course page

by Peter Roemeling -
What does that mean, That there is a new release soon and the problem is solved?
Regards,
Peter
In reply to Richard van Iwaarden

Re: Description won't show on course page

by Alain Raap -
We have the same issue with this plugin, I see the bug still isn't fixed, anyone who knows the status of the plugin and a next version?

mod_questionnaire 4.0.1 (Build - 2023051600) 2022092202
Moodle 4.1.9 (Build: 20240212)
In reply to Alain Raap

Re: Description won't show on course page

by Olivier Allain -
Hi

I just bumped into this bug...
Same version I reckon: 4.0.1 (Build - 2023051600)
Still no description displayed on the course page
Moodle version 4.1