Skip to content
Permalink
Browse files
Merge branch 'MDL-62533-master' of git://github.com/zig-moodle/moodle
  • Loading branch information
David Monllao committed Jul 10, 2018
2 parents 39650bc + a8f7818 commit cbc67cba73c3ab559d2cbe8adbe9900a2e476075
Showing with 55 additions and 5 deletions.
  1. +7 −4 mod/assign/locallib.php
  2. +6 −1 mod/assign/renderable.php
  3. +4 −0 mod/assign/renderer.php
  4. +38 −0 mod/assign/tests/behat/assign_hidden.feature
@@ -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) {
@@ -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);
@@ -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;
@@ -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
@@ -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,
@@ -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;
@@ -790,6 +794,7 @@ public function __construct($participantcount,
$this->teamsubmission = $teamsubmission;
$this->warnofungroupedusers = $warnofungroupedusers;
$this->cangrade = $cangrade;
$this->isvisible = $isvisible;
}
}

@@ -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) {
@@ -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 cbc67cb

Please sign in to comment.