Skip to content

Commit

Permalink
CTP-4101 Fix: Grading summary visible to students (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonstr authored Jan 15, 2025
1 parent 59a4194 commit 0a37564
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 4 additions & 2 deletions renderers/object_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,10 @@ protected function render_mod_coursework_coursework(mod_coursework_coursework $c
$allowedtoaddgeneralfeedback = has_capability('mod/coursework:addgeneralfeedback', $coursework->get_context());
$canaddgeneralfeedback = has_capability('mod/coursework:addgeneralfeedback', $this->page->context);

$out .= html_writer::tag('h3', get_string('gradingsummary', 'coursework'));
$out .= $this->coursework_grading_summary_table($coursework);
if ($cangrade || $canpublish) {
$out .= html_writer::tag('h3', get_string('gradingsummary', 'coursework'));
$out .= $this->coursework_grading_summary_table($coursework);
}

// Show general feedback if it's there and the deadline has passed or general feedback's date is not enabled which means it should be displayed automatically
if (($coursework->is_general_feedback_enabled() && $allowedtoaddgeneralfeedback && (time() > $coursework->generalfeedback || $cangrade || $canpublish || $ispublished)) || !$coursework->is_general_feedback_enabled()) {
Expand Down
22 changes: 22 additions & 0 deletions tests/behat/grading_summary_visibility.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@mod @mod_coursework

Feature: Grading summary table visibility
Grading summary shouldn't be displayed to students

Background:
Given there is a course
And there is a coursework
And there is a student
And there is a teacher

Scenario: Grading summary table is visible to teachers
Given I log in as the teacher
And I visit the coursework page
Then I should see "Grading Summary"
And I should see "Graded and published"

Scenario: Grading summary table is not visible to students
Given I log in as the student
And I visit the coursework page
Then I should not see "Grading Summary"
And I should not see "Graded and published"

0 comments on commit 0a37564

Please sign in to comment.