Skip to content

Commit

Permalink
MDL-78775 core_grades: Fix saving on grader report page
Browse files Browse the repository at this point in the history
When we have a pagination on grader page and search for user
that is not on first page, saving was throwing an error
since page didn't have enough data
  • Loading branch information
ilyatregubov committed Oct 13, 2023
1 parent 9713039 commit f0c782c
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 8 deletions.
13 changes: 13 additions & 0 deletions grade/lib.php
Expand Up @@ -1051,6 +1051,12 @@ class grade_plugin_return {
* @var int
*/
public $page;
/**
* Search string
*
* @var string
*/
public $search;

/**
* Constructor
Expand All @@ -1064,6 +1070,7 @@ public function __construct($params = []) {
$this->userid = optional_param('gpr_userid', null, PARAM_INT);
$this->groupid = optional_param('gpr_groupid', null, PARAM_INT);
$this->page = optional_param('gpr_page', null, PARAM_INT);
$this->search = optional_param('gpr_search', '', PARAM_NOTAGS);

foreach ($params as $key => $value) {
if (property_exists($this, $key)) {
Expand Down Expand Up @@ -1217,6 +1224,12 @@ public function get_form_fields() {
if (!empty($this->page)) {
$result .= '<input type="hidden" name="gpr_page" value="'.$this->page.'" />';
}

if (!empty($this->search)) {
$result .= html_writer::empty_tag('input',
['type' => 'hidden', 'name' => 'gpr_search', 'value' => $this->search]);
}

return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion grade/report/grader/amd/build/search.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f0c782c

Please sign in to comment.