Commit Graph

46 Commits

Author SHA1 Message Date
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Eloy Lafuente (stronk7)
3a016e2784 MDL-73824 gradebook: Add support for localised floats where missing
It has been detected, thanks to php80 specially, that there are
various places in core where support for localised floats is
missing. Before php80, some locale-dependent conversions were
performed by PHP, allowing things to work. But with php80 all
those comparisons are now locale-independent. See:

https://wiki.php.net/rfc/locale_independent_float_to_string

That implies that we now need to, always, unformat floats to
be internally the correct (decimal point as separator) in
order to compare it.

While this was visited in the php80 epic (MDL-70745), nothing
was found, all automated tests were passing ok. Problem is that
we run behat tests with en-AU laguage that has the decimal point
separator.

So, in this issue we are fixing all the problems detected by
running those Behat tests using localised (comma) decimal
separator.

Note that there may be other places still causing problems, but
it's really hard to find them programmatically, so we'll have to
wait for real use reports / issues and go fixing them while they
happen.

Back to this commit, this is the list of changes performed (note that
in the next commit, we'll be adding scenarios explicitly using
a localised decimal separator to ensure that they work ok).

A. Changes to various grade forms to ensure that, on their validation
  floats are unformatted properly. Also, changed the corresponding
  form element from current text/PARAM_RAW to proper float ones that
  take care of the conversion in a number of places (but when disabled,
  that's the reason we still have to unformat in validation.
  This includes the following forms:
    - edit_category_form
    - edit_item_form
  (this is the original problem reported that cause all the research
  to be performed against full behat runs)

B. Changes to edit_letter_form, so it uses a proper PARAM_LOCALISEDFLOAT
  (note this is the type of change that surely should be used for all
  the rest of /grade/edit/tree form, including those in the previous
  point).

C. Changes to the grade_item behat generator, so it's able to work with
  localised floats, un-formatting them when needed.
  At lib/behat/classes/behat_core_generator.php

D. Fix problem passing localised floats to scales, not displaying
  properly. At grade/report/singleview/classes/local/ui/finalgrade.php

E. Change the behat text matcher in order to allow comparison of
  localised floats when they are the current ones. Before this change
  the matches was using soft/lazy comparison, so '50' and '50.0000'
  match. Now, when the comma (for example) is used (and only then),
  '50' and '50,000' will also match. This comparison is in use in a
  bunch of tests and makes sense to make it localisation-aware.
  At grade/report/singleview/classes/local/ui/finalgrade.php

F. Fix a couple of number_format() uses in lesson, because they are
  not localised-aware. Switched to format_float(). At mod/lesson/locallib.php

G. Change the quiz_contains_the_following_questions() step to accept
  localised maxmark expectations. At mod/quiz/tests/behat/behat_mod_quiz.php

H. Change the quiz generator so it accepts localised gradepass.
  At mod/quiz/tests/generator/lib.php

I. Change the edit question form to show proper localised penalties,
  previously it was always showing point-decimal ones. Of course,
  leaving the values of the select element unmodified (internal floats).
  Related, also change a couple of tests to, instead of try to match the
  value (always internal floats), match the description (now localised),
  so we can test them with different separators. At:
    - question/type/ddimageortext/tests/behat/backup_and_restore.feature
    - question/type/ddmarker/tests/behat/backup_and_restore.feature
    - question/type/edit_question_form.php
2022-03-04 10:22:49 +01:00
Peter Burnett
309f54bf81 MDL-67306 webservices: Added webservice for Grade category creation 2020-09-03 00:20:44 +02:00
Jun Pataleta
d9ce6a4ffb MDL-32151 grade: Use appropriate error langstring error key 2017-06-23 10:22:24 +08:00
Cameron Ball
fa8e27b32b MDL-52522 grades: Add rescale grades option for grade categories.
When a grade category is overridden, it starts to behave like a regular grade item.
Therefore we need similar behaviour to what was implemented in MDL-48634.
2016-03-08 16:26:44 +08:00
Adrian Greeve
4d4dcc2718 MDL-48239 gradebook: Calculated grades maxgrade now able to be set. 2015-07-02 11:13:25 +08:00
Marina Glancy
663949e652 MDL-47417 core_grades: reset grademax when switching from Natural
in Natural aggregation method the grademax is automatically adjusted
when switching to another aggregation method it should be reset
to 100
2014-10-03 13:55:23 +08:00
Marina Glancy
513d2118dd MDL-47146 core_grades: fix navigation bar in grades setup pages
Part of: MDL-46576
2014-10-03 13:54:39 +08:00
Marina Glancy
8faa560ca9 MDL-47146 core_grades: merge simple and full view in setup
Part of: MDL-46576
2014-10-03 13:54:38 +08:00
John Okely
d6447690bd MDL-47006 core_grades: Change category and item forms back to using
aggregationcoef and aggregationcoef2

Part of MDL-46576.
2014-10-03 13:54:07 +08:00
John Okely
0281770091 MDL-47006 core_grades: Fix float formatting
Part of MDL-46576
2014-10-03 13:54:07 +08:00
John Okely
b6a1e366a7 MDL-46576 core_grades: MDL-47006 Refactor weightings code for readibility 2014-10-03 13:54:07 +08:00
Frederic Massart
276690035f MDL-47098 core_grades: Fields to adjust a category's weight 2014-10-03 13:51:29 +08:00
Adrian Greeve
d40604724b MDL-34463 - lib - Alteration of the get_context_instance function to utilize the new function context_XXXX::instance(). 2012-07-24 14:04:40 +08:00
Andrew Davis
a153c9f2fe MDL-30999 grade: updated Grade API phpdocs 2012-02-14 14:04:19 +07:00
Petr Skoda
4cc977a64d fixing messed up property_exists() regression - sorrrry 2010-09-17 20:36:49 +00:00
Petr Skoda
4d27bc7929 fixed phpdocs and using property_exists() which is required by PHP 5.3 2010-09-17 19:05:23 +00:00
Andrew Davis
2821c4955b gradebook MDL-22931 made some of the setting labels more specific and made blocks show on category setting screen 2010-07-08 07:09:10 +00:00
Petr Skoda
a685593466 MDL-21233 moodle_url improvemewnts, code simplification, more diagnostics; fixed several regressions 2010-01-16 15:39:56 +00:00
Petr Skoda
6c3ef4103a MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup 2009-11-01 12:11:29 +00:00
samhemelryk
beebcf2606 grade MDL-19797 Added set_url calls 2009-10-15 06:58:21 +00:00
nicolasconnault
5a93139440 MDL-19797 Converted all print_footer() calls 2009-08-06 14:12:17 +00:00
nicolasconnault
e060e33dc3 MDL-19727 Replaced boilerplates and removed ID tags. Merged from MOODLE_19_STABLE 2009-07-07 02:26:36 +00:00
nicolasconnault
1cfecb0286 MDL-19404 Getting default values for grade_item object when creating a new grade_category. Merged from MOODLE_19_STABLE 2009-07-07 02:04:15 +00:00
nicolasconnault
5939e44447 MDL-19429 Validating 0 values for grademin, grademax and gradepass for the edit category form. Also checking for grademax < grademin case. Merged from MOODLE_19_STABLE 2009-07-07 01:57:45 +00:00
skodak
b925fe0a00 MDL-19323 added missing support for localized floats on category edit page + more cleanup; merged from MOODLE_19_STABLE 2009-05-29 17:30:53 +00:00
skodak
4b4c1d1d68 MDL-19068 fixed item decimals before saving item; merged from MOODLE_19_STABLE 2009-05-08 13:18:09 +00:00
skodak
d9be236f5d MDL-19091 removed custom scales from different courses + added BC hack; backported from MOODLE_19_STABLE 2009-05-07 08:39:29 +00:00
nicolasconnault
28087eb710 MDL-12444 Removed aggregationview preference from category edit form. Merged from MOODLE_19_STABLE 2009-05-07 07:57:04 +00:00
skodak
d9ae2ab53b MDL-12942 new extra credit option for simple mean agg; merged from MOODLE_19_STABLE 2009-04-24 16:24:49 +00:00
nicolasconnault
28a6ca98ca MDL-18190 2009-02-10 12:52:53 +00:00
nicolasconnault
dc482cfac0 MDL-18083 (including MDL-15680, MDL-17829, MDL-17807, MDL-18004, MDL-12631, MDL-16913) 2009-02-09 10:49:41 +00:00
skodak
294ce9870f MDL-15189 magic quotes finally removed 2008-06-09 16:53:30 +00:00
nicolasconnault
5c75a0a3b4 MDL-14967 DB upgrades. All done. Just bug fixing now ;) 2008-06-03 16:10:57 +00:00
dongsheng
1bb0aa0f06 "MDL-14129, fix print_error" 2008-05-14 07:24:28 +00:00
dongsheng
5a2a53316f MDL-14129, remove all the other error() call 2008-04-04 02:54:20 +00:00
nicolasconnault
8f6fdf4335 MDL-13674 Course category fullname field is no longer required. If set to empty it will be recorded in the DB as ?, and the course name will be used instead wherever the category name is displayed. Merging from MOODLE_19_STABLE. 2008-02-27 12:48:20 +00:00
skodak
e2eb2edbad MDL-12140 category can be selected when adding new items or categories; merged from MOODLE_19_STABLE 2007-11-15 08:29:12 +00:00
skodak
190af29fef MDL-12146 grade category defaults, forced settings and advanced options, merged from MOODLE_19_STABLE 2007-11-14 11:52:21 +00:00
toyomoyo
cccade627d MDL-12140, making most common non-weighted and weighted settings easy for teachers 2007-11-14 02:12:40 +00:00
skodak
0758a08e2a MDL-10901 new SUM aggregation type
MDL-12154 used proper cast to float before !== comparison
2007-11-13 15:08:59 +00:00
skodak
89a5f82768 MDL-11278 improved forced category settings - refactoring + regrading forced + new setting to hide forced settings in UI 2007-10-20 15:00:31 +00:00
nicolasconnault
8ad36f4cc3 Added copyright notice 2007-10-10 06:34:20 +00:00
skodak
41486d1c40 MDL-10702 fixing handling of slashes in grade forms 2007-08-03 08:12:06 +00:00
nicolasconnault
826c5f8635 MDL-9628 Refactoring the building of navigation array for gradebook pages 2007-08-01 06:47:35 +00:00
skodak
78ad5f3ff0 MDL-10544 placeholder for outcome edit forms grade/edit/outcome/
MDL-10650 scales code moved to grade/edit/scale/
refactoring in grade/edit/
2007-07-29 23:02:03 +00:00