PoetOS / moodle-mod_questionnaire

Questionnaire module for Moodle - Contributed module
GNU General Public License v3.0
79 stars 182 forks source link

option "Display description on course page" doesn't work in 4.1 Moodle platform #487

Open lcaylat opened 1 year ago

lcaylat commented 1 year ago

This problem has been mentioned in the Questionnaire forum at https://moodle.org/mod/forum/discuss.php?d=445099

A solution is proposed :

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;

}

simmonsgc commented 1 year ago

Can confirm this with plugin version 2022092202 on Moodle Version 4.1.4 (Build: 20230612).

lcaylat commented 1 year ago

After new tests :

Description is displayed on course section in this case :

Description is not displayed on course section in this case :

I close the ticket :-)

simmonsgc commented 1 year ago

Good day - We did not find this to be true:

**Description is displayed on course section in this case :

mod_questionnaire 4.0.1 (Build - 2023051600) 2022092202 Moodle 4.1.4**

Our environment is: mod_questionnaire 4.0.1 (Build - 2023051600) 2022092202 Moodle Version 4.1.4 (Build: 20230612)

…but still no questionnaire description displayed on course page. Does not appear to be resolved from our view.

Thanks for any additional info or guidance,

lcaylat commented 1 year ago

Sorry... I think I still had the modification of the lib.php file cached in my browser. Indeed, the problem is not solved at all with the following configuration:

I hope the solution will come soon.

Richardvi commented 11 months ago

Just want to confirm that this issue is also on Moodle 4.2 (and probably Moodle 4.3)

Hope there will be an update soon!

FelixDiLenarda commented 11 months ago

Issue still exist in Moodle 4.1

Richardvi commented 9 months ago

Issue also exists in Moodle 4.3.2

licethrey91 commented 8 months ago

Hi Team, I would like to know if you have any updates on this?

Thank you!

asmraap commented 8 months ago

Can this bug in mod_questionnaire be fixed? We have the same problem with version mod_questionnaire 4.0.1 (Build - 2023051600) 2022092202 Moodle 4.1.9 (Build: 20240212)

mchurchward commented 8 months ago

This was fixed in #516.

licethrey91 commented 8 months ago

Hi Mike, Please can you tell me the version in which the solution was implemented?

Thank you!

mchurchward commented 8 months ago

If you go to the PR link above, the last comment shows the commit number and the branch that the fix was applied to.

asmraap commented 8 months ago

When will this fix be available in the Moodle plugins library?

mchurchward commented 8 months ago

Next release isn't scheduled yet, but will be sometime this month.

melvyng commented 7 months ago

this code works but in Moodle 4.1.9 show twice the information in the course page image