Merge branch 'MDL-52309' of https://github.com/smbader/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 18 Jan 2016 01:33:36 +0000 (09:33 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 18 Jan 2016 01:33:36 +0000 (09:33 +0800)
grade/report/history/index.php
grade/report/history/tests/behat/basic_functionality.feature

index 905f91e..f4e7461 100644 (file)
@@ -30,9 +30,10 @@ require_once($CFG->dirroot.'/grade/lib.php');
 $download      = optional_param('download', '', PARAM_ALPHA);
 $courseid      = required_param('id', PARAM_INT);        // Course id.
 $page          = optional_param('page', 0, PARAM_INT);   // Active page.
+$showreport    = optional_param('showreport', 0, PARAM_INT);
 
 $PAGE->set_pagelayout('report');
-$url = new moodle_url('/grade/report/history/index.php', array('id' => $courseid));
+$url = new moodle_url('/grade/report/history/index.php', array('id' => $courseid, 'showreport' => 1));
 $PAGE->set_url($url);
 
 $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
@@ -105,15 +106,18 @@ if ($table->is_downloading()) {
 print_grade_page_head($COURSE->id, 'report', 'history', get_string('pluginname', 'gradereport_history'), false, '');
 $mform->display();
 
-// Render table.
-echo $output->render($table);
+// MDL-52309: Display report after form has been submitted.
+if ($showreport) {
+    // Render table.
+    echo $output->render($table);
 
-$event = \gradereport_history\event\grade_report_viewed::create(
-    array(
-        'context' => $context,
-        'courseid' => $courseid
-    )
-);
-$event->trigger();
+    $event = \gradereport_history\event\grade_report_viewed::create(
+        array(
+            'context' => $context,
+            'courseid' => $courseid
+        )
+    );
+    $event->trigger();
+}
 
 echo $OUTPUT->footer();
index 238fbf6..0cfc905 100644 (file)
@@ -47,7 +47,8 @@ Feature: A teacher checks the grade history report in a course
     And I give the grade "70.00" to the user "Student 2" for the grade item "The greatest assignment ever"
     And I give the grade "80.00" to the user "Student 2" for the grade item "Rewarding assignment"
     And I press "Save changes"
-    When I follow "Grade history"
+    And I follow "Grade history"
+    When I press "Submit"
     Then the following should exist in the "gradereport_history" table:
       | First name/Surname | Grade item                    | Original grade | Revised grade | Grader    |
       | Student 1          | The greatest assignment ever  |                | 50.00         | Teacher 1 |