From b50f58ec0d8a90fbaad82e17a9a25cab76b0bf9d Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Thu, 11 Dec 2025 13:38:18 +0000 Subject: [PATCH] MDL-72833 quiz: Respect locale in maxmark setting Editing maxmarks in quiz slots was not respecting the decimal separator from the set language's locale, meaning if your language formats numbers like 1,10 editing didn't work correctly. This sets the correct parameter to ensure the locale is respected. --- public/mod/quiz/edit_rest.php | 2 +- .../editing_set_marks_no_attempts.feature | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/public/mod/quiz/edit_rest.php b/public/mod/quiz/edit_rest.php index 20cd2c788d7..3798ac179a3 100644 --- a/public/mod/quiz/edit_rest.php +++ b/public/mod/quiz/edit_rest.php @@ -45,7 +45,7 @@ $summary = optional_param('summary', '', PARAM_RAW); $sequence = optional_param('sequence', '', PARAM_SEQUENCE); $visible = optional_param('visible', 0, PARAM_INT); $pageaction = optional_param('action', '', PARAM_ALPHA); // Used to simulate a DELETE command. -$maxmark = optional_param('maxmark', '', PARAM_FLOAT); +$maxmark = optional_param('maxmark', '', PARAM_LOCALISEDFLOAT); $newheading = optional_param('newheading', '', PARAM_TEXT); $shuffle = optional_param('newshuffle', 0, PARAM_INT); $page = optional_param('page', '', PARAM_INT); diff --git a/public/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature b/public/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature index 1291409ebd7..cfad32d7da3 100644 --- a/public/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature +++ b/public/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature @@ -46,6 +46,24 @@ Feature: Edit quiz marks with no attempts And I should see "Total of marks: 10.00" And "li input[name=maxmark]" "css_element" should not exist + @javascript + Scenario: Set the max mark for a question taking locale into account + Given the following "language customisations" exist: + | component | stringid | value | + | core_langconfig | decsep | , | + And I reload the page + When I set the max mark for question "First question" to "7,5" + Then I should see "7,50" + And I should see "3,00" + And I should see "Total of marks: 10,50" + + And I follow "Edit maximum mark" + And I press the escape key + And I should see "7,50" + And I should see "3,00" + And I should see "Total of marks: 10,50" + And "li input[name=maxmark]" "css_element" should not exist + @javascript Scenario: Set the overall Maximum grade. When I set the field "maxgrade" to "10.0"