Skip to content

Commit

Permalink
MDL-62533 assign: Show assign hidden status on grading summary page
Browse files Browse the repository at this point in the history
  • Loading branch information
zig-moodle committed Jun 29, 2018
1 parent f61ee4e commit a8f7818
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
11 changes: 7 additions & 4 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -5326,12 +5326,14 @@ public function get_all_submissions($userid) {
public function get_assign_grading_summary_renderable($activitygroup = null) {

$instance = $this->get_instance();
$cm = $this->get_course_module();

$draft = ASSIGN_SUBMISSION_STATUS_DRAFT;
$submitted = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
$isvisible = $cm->visible;

if ($activitygroup === null) {
$activitygroup = groups_get_activity_group($this->get_course_module());
$activitygroup = groups_get_activity_group($cm);
}

if ($instance->teamsubmission) {
Expand All @@ -5349,7 +5351,8 @@ public function get_assign_grading_summary_renderable($activitygroup = null) {
$this->count_submissions_need_grading($activitygroup),
$instance->teamsubmission,
$warnofungroupedusers,
$this->can_grade());
$this->can_grade(),
$isvisible);
} else {
// The active group has already been updated in groups_print_activity_menu().
$countparticipants = $this->count_participants($activitygroup);
Expand All @@ -5364,8 +5367,8 @@ public function get_assign_grading_summary_renderable($activitygroup = null) {
$this->count_submissions_need_grading($activitygroup),
$instance->teamsubmission,
false,
$this->can_grade());

$this->can_grade(),
$isvisible);
}

return $summary;
Expand Down
7 changes: 6 additions & 1 deletion mod/assign/renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ class assign_grading_summary implements renderable {
public $warnofungroupedusers = false;
/** @var boolean cangrade - Can the current user grade students? */
public $cangrade = false;
/** @var boolean isvisible - Is the assignment's context module visible to students? */
public $isvisible = true;

/**
* constructor
Expand All @@ -765,6 +767,7 @@ class assign_grading_summary implements renderable {
* @param int $submissionsneedgradingcount
* @param bool $teamsubmission
* @param bool $cangrade
* @param bool $isvisible
*/
public function __construct($participantcount,
$submissiondraftsenabled,
Expand All @@ -777,7 +780,8 @@ public function __construct($participantcount,
$submissionsneedgradingcount,
$teamsubmission,
$warnofungroupedusers,
$cangrade = true) {
$cangrade = true,
$isvisible = true) {
$this->participantcount = $participantcount;
$this->submissiondraftsenabled = $submissiondraftsenabled;
$this->submissiondraftscount = $submissiondraftscount;
Expand All @@ -790,6 +794,7 @@ public function __construct($participantcount,
$this->teamsubmission = $teamsubmission;
$this->warnofungroupedusers = $warnofungroupedusers;
$this->cangrade = $cangrade;
$this->isvisible = $isvisible;
}
}

Expand Down
4 changes: 4 additions & 0 deletions mod/assign/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ public function render_assign_grading_summary(assign_grading_summary $summary) {
$o .= $this->output->box_start('boxaligncenter gradingsummarytable');
$t = new html_table();

// Visibility Status.
$this->add_table_row_tuple($t, get_string('hiddenfromstudents'),
(!$summary->isvisible) ? get_string('yes') : get_string('no'));

// Status.
if ($summary->teamsubmission) {
if ($summary->warnofungroupedusers) {
Expand Down
38 changes: 38 additions & 0 deletions mod/assign/tests/behat/assign_hidden.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@mod @mod_assign @javascript
Feature: When a Teacher hides an assignment from view for students it should consistently indicate it is hidden.

Scenario: Grade multiple students on one page
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test hidden assignment |
And I open "Test hidden assignment" actions menu
And I choose "Hide" in the open action menu
And I follow "Test hidden assignment"
And I should see "Test hidden assignment"
And I should see "Yes" in the "Hidden from students" "table_row"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "2" and I fill the form with:
| Assignment name | Test visible assignment |
And I follow "Test visible assignment"
And I should see "Test visible assignment"
And I should see "No" in the "Hidden from students" "table_row"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I should not see "Test hidden assignment"
And I should see "Test visible assignment"
And I log out

0 comments on commit a8f7818

Please sign in to comment.