Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.9.8, 1.9.9
-
Fix Version/s: None
-
Component/s: Module: Questionnaire
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
Description
The Questionnaire module has a setting where instructors can choose whether students can see all responses Never, After answering the questionnaire, After the questionnaire is closed, or Always.
No matter which option is selected, students can only see their own responses, not those of other students.
This is happening on my production 1.9.8 server and also on a clean 1.9.9 instance with the latest Questionnaire code.
Ok, I think I've figured this out. The elseif statement in tabs.php around line 153 should be:
} else if (($questionnaire->resp_view == $QUESTIONNAIRE_STUDENTVIEWRESPONSES_ALWAYS ||
($questionnaire->resp_view == $QUESTIONNAIRE_STUDENTVIEWRESPONSES_WHENCLOSED
&& $questionnaire->is_closed()) ||
($questionnaire->resp_view == $QUESTIONNAIRE_STUDENTVIEWRESPONSES_WHENANSWERED
&& !$questionnaire->user_can_take($USER->id))) &&
$questionnaire->is_survey_owner()) {
The other pieces cause this to work incorrectly.
$questionnaire->capabilities->readallresponses checks for the mod/questionnaire:readallresponses capability ("Read response summaries, subject to open times") looks like it should be part of the elseif (i.e. users should have this capability in order to view all responses). However, this capability is Not Set for students by default, which makes this whole drop-down menu of options for when students can view all responses moot, not to mention confusing to instructors. We could keep this line in the elseif, but we'd probably also want to set this capability to Allow for students by default, which would require seeing where else in the code this capability comes into play. (We don't want students viewing all responses when they shouldn't!)
The second part of the elseif, ($numresp > 0) , is problematic because if the resp_view variable is set to allow students to see all responses Always, they should not be required to have > 0 responses in order to see all responses. (Actually, should this statement be part of the "WHENANSWERED" portion of the elseif?)
I'll attach the patch file momentarily.