MDL-62668 mod_workshop: Return feedback for reviewer in assessment phase

Teachers were not able to view the existing feedback.
This commit is contained in:
Juan Leyva 2018-11-16 15:48:39 +01:00
parent c092f75791
commit d8035d9391
2 changed files with 6 additions and 2 deletions

View file

@ -1042,8 +1042,11 @@ class mod_workshop_external extends external_api {
return null;
}
// Remove the feedback for the reviewer if the feedback phase is not valid or if we don't have enough permissions to see it.
if ($workshop->phase < workshop::PHASE_EVALUATION || !($isreviewer || $canviewallassessments)) {
// Remove the feedback for the reviewer if:
// I can't see it in the evaluation phase because I'm not a teacher or the reviewer AND
// I can't see it in the assessment phase because I'm not a teacher.
if (($workshop->phase < workshop::PHASE_EVALUATION || !($isreviewer || $canviewallassessments)) &&
($workshop->phase < workshop::PHASE_ASSESSMENT || !$canviewallassessments) ) {
// Remove all the feedback information (all the optional fields).
foreach ($properties as $attribute => $settings) {
if (!empty($settings['optional'])) {

View file

@ -1451,6 +1451,7 @@ class mod_workshop_external_testcase extends externallib_advanced_testcase {
$result = mod_workshop_external::get_reviewer_assessments($this->workshop->id, $this->student->id);
$result = external_api::clean_returnvalue(mod_workshop_external::get_reviewer_assessments_returns(), $result);
$this->assertCount(2, $result['assessments']);
$this->assertArrayNotHasKey('feedbackreviewer', $result['assessments'][0]);
}
/**