Skip to content

Commit

Permalink
StudentQuiz: Make show all link working with pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuvu committed Dec 17, 2024
1 parent 96d78b7 commit 6719a4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions classes/question/bank/studentquiz_bank_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,16 @@ public function load_questions() {
return $questions;
}

#[\Override]
protected function load_page_questions(): \moodle_recordset {
global $DB;
if (!$this->pagevars['showall']) {
return parent::load_page_questions();
} else {
return $DB->get_recordset_sql($this->loadsql, $this->sqlparams);
}
}

/**
* TODO: rename function and apply (there is duplicate method)
* @return bool studentquiz is set to anoymize ranking.
Expand Down
5 changes: 5 additions & 0 deletions tests/behat/pagination.feature
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ Feature: Test pagination for StudentQuiz
# Verify that the first question and the last question are displayed, ensuring all essential questions are visible.
And I should see "TF 01"
And I should see "Test question 9"
And I click on "Show 20 per page" "link"
# Verify that the first question and the last question are displayed, ensuring all essential questions are visible when click show all.
And I click on "Show all 25" "link"
And I should see "TF 01"
And I should see "Test question 24"

@javascript
Scenario: Users using filter should keep the same pagination.
Expand Down

0 comments on commit 6719a4f

Please sign in to comment.