From ebfc7ac005be37914d128a7afda5343f7245a14e Mon Sep 17 00:00:00 2001 From: "Kristiina.Bax" Date: Fri, 23 May 2025 14:35:40 +0100 Subject: [PATCH] MDL-85492 report_questioninstances: sort qtypes in alphabetical order --- report/questioninstances/index.php | 3 +++ report/questioninstances/tests/behat/question_reports.feature | 2 ++ 2 files changed, 5 insertions(+) diff --git a/report/questioninstances/index.php b/report/questioninstances/index.php index 719b867b357..2d549d8482e 100644 --- a/report/questioninstances/index.php +++ b/report/questioninstances/index.php @@ -45,6 +45,9 @@ foreach ($qtypes as $qtype) { $qtypechoices[$qtype->name()] = $qtype->local_name(); } +// Sort by label. +core_collator::asort($qtypechoices); + // Print the settings form. echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter centerpara'); echo '
'; diff --git a/report/questioninstances/tests/behat/question_reports.feature b/report/questioninstances/tests/behat/question_reports.feature index bd249365680..e12b9eb6b47 100644 --- a/report/questioninstances/tests/behat/question_reports.feature +++ b/report/questioninstances/tests/behat/question_reports.feature @@ -35,6 +35,8 @@ Feature: A Teacher can generate question instance reports Scenario: Generate general and specific report Given I am on the "C1" "Course" page logged in as "admin" And I navigate to "Reports > Question instances" in site administration + # Checks the dropdown list is in alphabetical order + And "Matching" "option" should appear before "Select missing words" "option" in the "Question type" "select" When I press "Get the report" Then "Quiz: Test quiz Q001" row "Total" column of "generaltable" table should contain "2" And "Quiz: Test quiz Q001" row "Visible" column of "generaltable" table should contain "2"