Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
MDL-47838 gradebook: Singleview fix for invalid links.
Browse files Browse the repository at this point in the history
  • Loading branch information
zbdd authored and stronk7 committed Oct 24, 2014
1 parent 7a811fb commit 237f76c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
13 changes: 8 additions & 5 deletions grade/report/singleview/classes/local/screen/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,19 @@ public function format_line($item) {
if (isset($item->cmid)) {
$realmodid = $item->cmid;
}
$url = new moodle_url('/mod/' . $item->itemmodule . '/view.php', array('id' => $realmodid));

$iconstring = get_string('filtergrades', 'gradereport_singleview', $item->get_name());
$grade->label = $item->get_name();

$itemlabel = $item->get_name();
if (!empty($realmodid)) {
$url = new moodle_url('/mod/' . $item->itemmodule . '/view.php', array('id' => $realmodid));
$itemlabel = html_writer::link($url, $item->get_name());
}

$line = array(
$OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', $iconstring)),
$this->format_icon($item) . $lockicon,
html_writer::link($url, $item->get_name()),
$this->category($item),
(new range($item))
$this->format_icon($item) . $lockicon, $itemlabel, $this->category($item), (new range($item))
);
return $this->format_definition($line, $grade);
}
Expand Down
16 changes: 12 additions & 4 deletions grade/report/singleview/tests/behat/singleview.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Feature: We can use Single view
| student2 | Student | 2 | student1@asd.com | s2 | holly |
| student3 | Student | 3 | student1@asd.com | s3 | anna |
| student4 | Student | 4 | student1@asd.com | s4 | zac |
And the following "grade items" exist:
| itemname | course |
| new grade item 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Expand All @@ -36,7 +39,7 @@ Feature: We can use Single view
And I follow "Course 1"
And I follow "Grades"

@javascript
@javascript
Scenario: I can update grades, add feedback and exclude grades.
Given I click on "Single view" "option"
And I click on "Student 4" "option"
Expand Down Expand Up @@ -71,10 +74,8 @@ Feature: We can use Single view
And I follow "Single view for Student 1"
Then I should see "Student 1"

@javascript
Scenario: Navigation works in the Single view.
Given I click on "Single view" "option"
Then I click on "Student 1" "option"
Given I follow "Single view for Student 1"
Then I should see "Student 1"
And I follow "Student 2"
Then I should see "Student 2"
Expand All @@ -86,3 +87,10 @@ Feature: We can use Single view
Then I should see "Test assignment three"
And I follow "Test assignment four"
Then I should see "Test assignment four"

Scenario: Activities are clickable only when
it has a valid activity page.
Given I follow "Single view for Student 1"
And "new grade item 1" "link" should not exist in the "//tbody//tr[position()=1]//td[position()=2]" "xpath_element"
Then "Category total" "link" should not exist in the "//tbody//tr[position()=2]//td[position()=2]" "xpath_element"
And "Course total" "link" should not exist in the "//tbody//tr[position()=last()]//td[position()=2]" "xpath_element"

0 comments on commit 237f76c

Please sign in to comment.