This is a split of
MDL-73824, where it's being checked how PHP8 behaves with non-english, different from the decimal point (.) sites.
it has been split from it, because it's a pre-existing bug, causing the AJAX grader not to work properly when any site (say Spanish, French... ) is not using the decimal point, but others (comma...) as separator.
- In a site with some course and activity grades.
- Set the current language to Spanish, French (any lang not using the decimal point (.).
- Go to the gradebook of the course.
- Go to grader report preferences / settings.
- Enable the AJAX grader.
- Go back to the grader report.
- Edit inline any existing activity grade and change it to something like '5,67' (using the comma decsep).
- The grade is stored properly in the database (5.67 float).
- The grader report shown 5,67 (current lang) when the grade comes back from the backend.
- Depending of the PHP version being used, the grade can end in the database as just 5 (or fail to be saved).
- The grader report shows 5.67 (point decsep) when the grade comes back from the backend.
A little bit of research shows 2 problems:
1) The grade/report/grader/ajax_callbacks.php is missing a:
in order to send back the float in the current language (using comma).
2) The grade/report/grader/module.js module is doing some parseFloat() executions that prevent the comma to be shown back.
3) Also, while trying to reproduce it, Sara has found that there is a slight color difference between grades overridden without AJAX and grade overridden with the AJAX grader enabled. They both should match.
So, this issue should aim to:
a) Make the backend to process and send back the floats properly.
b) Make the JS module to accept what the backend sends back to it.
c) Ensure the colors between non-ajax and ajax overridden changes are 100% the same.
d) Cover both dot and comma dec separators with a behat test to ensure that everything is working ok with any supported PHP version (7.3-8.0).