1299 Commits

Author SHA1 Message Date
Sara Arjona
e2d435ca93 Merge branch 'MDL-74286-master' of https://github.com/ferranrecio/moodle 2022-04-01 17:34:30 +02:00
Eloy Lafuente (stronk7)
4e2b4a138d MDL-74231 grader report: Fix case where old settings are empty / null
There is an edge case in the conversion from old collapse/expand
settings (stored as user preference) to the new ones that can lead
to notices / warnings / errors.

Before PHP 8, they weren't being detected, but now they are.

Basically, if some of the expected components of the preferences
are missing, then some array (array_diff(), array_intersect()..)
operations now are failing, because now those parameter functions
do require to be arrays (so empty strings or nulls aren't allowed).

Also, there were some cases where the old preference was not being
removed ever, so its removal has been moved to a common place at
the end of the function, where it's always evaluated in case
the preference still exists but is empty of contents.

I've tried to cover all the cases I've been able to imagine with
unit tests (empty information, some component not set, all components
not set...), have moved it to a new unit test because the one
already performing some tests with those old preferences was
already too long to add more cases.
2022-03-29 23:46:45 +02:00
Ferran Recio
fb3fb34b09 MDL-74286 gradereport_grader: fix overlap scale selector 2022-03-24 14:07:54 +01:00
Shamim Rezaie
a9d8207da9 Merge branch 'MDL-73824' of https://github.com/stronk7/moodle 2022-03-05 00:39:29 +11:00
Eloy Lafuente (stronk7)
43b4e6b339 MDL-73824 test: Cover all the changed code with special decsep tests
Various tests have been added to cover the points fixed in the previous
commit, using a localised decimal separator (#). Using the same
numbering, here there are the details:

A. grade/report/singleview/tests/behat/singleview.feature
   grade/tests/behat/grade_category_validation.feature

B. grade/tests/behat/grade_override_letter.feature

C. (done within various scenarios)

D. grade/report/singleview/tests/behat/singleview.feature

E. admin/tool/behat/tests/behat_form_text_test.php

F. grade/tests/behat/grade_to_pass.feature
   mod/lesson/tests/behat/lesson_informations_at_end.feature

G. quiz/tests/behat/preview.feature

H. mod/quiz/tests/behat/info_page.feature

I. question/type/ddimageortext/tests/behat/edit.feature
2022-03-04 10:22:49 +01:00
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
Eloy Lafuente (stronk7)
4003e31983 MDL-73785 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- When belonging to other components and being valid api:
  - analytics related tests have been moved to tests/analytics subdir.
  - backup & restore related tests have been moved to tests/backup subdir.
  - events related tests have been moved to tests/event subdir.
  - privacy related tests have been moved to tests/privacy.
  - task related tests have been moved to tests/task subdir.
- Some simple renames, not including the component part anymore (not
  needed now that they are namespaced):
  - some xxxlib_test.php have been renamed lib_test.php
    (when they where testing the corresponding lib.php).
  - cache stores tests have been all renamed store_test, originally
    each one had its own name (file_test, apcu_test, redis_test...)
  - assign feedback tests have been all renamed feedback_test, originally
    each one had its own name (file_test, editpdf_test...)
2022-03-03 12:19:30 +01:00
Andrew Nicols
e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.

Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.

Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.

The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.

Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
2022-02-23 08:55:09 +08:00
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Shamim Rezaie
a70a2b25de Merge branch 'MDL-73612-master-2' of https://github.com/bmbrands/moodle 2022-02-01 14:33:34 +11:00
Bas Brands
a74c715627 MDL-73612 gradereport_grader: drawer layout issues 2022-01-31 10:09:33 +01:00
Eloy Lafuente (stronk7)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Sara Arjona
8969abd82a MDL-73581 grade: Display success message on the same page
The "Grades were set for X items "message will be displayed on the
same screen, to safe one click to users and make it more consistent
with other similar actions in Moodle.
2022-01-18 15:12:55 +01:00
Víctor Déniz
ea3568ff6d Merge branch 'MDL-73572-master' of git://github.com/jleyva/moodle 2022-01-13 23:40:51 +00:00
Juan Leyva
7cb78905a0 MDL-73572 grade: Fix return type for gradeformatted
Regression caused MDL-70874
2022-01-13 12:49:44 +01:00
Paul Holden
6d18f136ae MDL-72772 gradereport_overview: account for users with parent roles. 2022-01-12 14:18:52 +01:00
Paul Holden
1964d68f85 MDL-72772 gradereport_overview: access checks for viewing grades. 2022-01-12 13:43:35 +08:00
Eloy Lafuente (stronk7)
511801cb46 MDL-73352 phpunit: lib_test and locallib_test testcase names
All lib_test and locallib_test classes:

- Namespaced with component (and API whenever makes sense).
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed or add new uses.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under login/tests:

1) The core_login component doesn't exist.
2) But login/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have login_xxxx as prefix.
2021-12-30 16:21:42 +01:00
Sara Arjona
65b10e3dc7 MDL-72911 behat: Unrelated, remove the @skip_interim tag
This commit is UNRELATED to the MDL-72911, but we need the
@skip_interim tag removed to one scenario that was causing lots
of noise and failures @ CI infrastructure. This tag can now be
removed because these failures were fixed a days ago.

So we are using MDL-72911 (this extra commit) to remove that tag
(sorry for the noise).
2021-12-29 11:13:10 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01:00
Mihail Geshoski
c728778df8 MDL-72873 core_grades: Update table headings in the user report page 2021-12-16 00:10:13 +08:00
Mihail Geshoski
17bfe7e79f MDL-72873 behat: Update behat tests 2021-12-16 00:10:13 +08:00
Mihail Geshoski
4f403bfdca MDL-72873 core_grades: Add tertiary nav in grader report preferences 2021-12-16 00:10:13 +08:00
Mihail Geshoski
d1a0e4a95c MDL-72873 core_grades: Add general tertiary navigation 2021-12-16 00:10:13 +08:00
Sujith Haridasan
1cdab24b3a MDL-71915 gradereport_grader: Fix ajax_grader failure
Fix ajax_grader behat failure.
2021-12-06 10:26:41 +05:30
Eloy Lafuente (stronk7)
2f1936be67 MDL-72791 behat: Unrelated, add the @skip_interim tag
This commit is UNRELATED to the MDL-72791, but we need the
@skip_interim tag added to one scenario that is causing lots
of noise and failures @ CI infrastructure.

So we are using MDL-72791 (this extra commit) to add that tag ASAP.
(sorry for the noise, the tag will be removed once the scenario
or its causes are fixed).
2021-12-01 17:15:56 +01:00
Tim Hunt
e1b28a7fc6 MDL-73140 grade history: fix badly formatted lists 2021-11-22 23:48:19 +00:00
Sara Arjona
dc0e7a45df Merge branch 'MDL-70721-master' of git://github.com/rezaies/moodle 2021-11-18 15:18:51 +01:00
Sara Arjona
b238091f7c Merge branch 'MDL-71699' of https://github.com/mkassaei/moodle 2021-11-17 08:53:34 +01:00
Shamim Rezaie
652392d932 MDL-70721 output: remove {{#quote}} wherever it was misused
Also use the new {{#cleanstr}} helper where it was more appropriate
than the {{#str} helper.
2021-11-16 10:08:06 +11:00
Mahmoud Kassaei
ad1747e28c MDL-71699 grade_report: Add custom user field support 2021-11-15 15:08:23 +00:00
Mathew May
6ca9c2154a MDL-70801 core_my: Add a new courses page 2021-11-15 11:49:35 +08:00
Jake Dallimore
c5a2e2db6c Merge branch 'MDL-71912-master-V4' of git://github.com/abgreeve/moodle 2021-11-09 11:47:55 +08:00
Mihail Geshoski
d06da2d1a0 MDL-71912 core_grading: Update behat step definitions 2021-11-09 11:24:08 +08:00
Huong Nguyen
ffca35b805 MDL-72896 Accessibility: Make html_table responsive
The tables are generated by html_table will responsive across viewports
2021-11-09 09:41:27 +07:00
Angelia Dela Cruz
89c4c803e8 MDL-72655 behat: Use assign generators
Replace steps that manually add assignment instances via the UI
and use Behat generators. This improves the speed of Behat test
runs.
2021-11-03 11:34:26 +08:00
Luca Bösch
aead4ba45a MDL-70874 gradereport_user: Add colors and icon distinguishing pass/fail 2021-10-06 16:36:12 +02:00
Andrew Nicols
4562ea0bd4 MDL-71610 gradereport_grader: Specify the pagelayout for grader report 2021-10-01 15:15:40 +08:00
Bas Brands
16c726cde7 MDL-71610 core_behat: use new edit mode step in feature files 2021-09-29 09:25:36 +02:00
Bas Brands
6ece030948 MDL-71610 theme_boost: switch to standard editing mode for gradebook
the gradebook need to use the standard $USER->editing to check if editing mode is turned on
2021-09-29 09:25:36 +02:00
Ilya Tregubov
3de9a4db4c Merge branch 'MDL-66549-master' of git://github.com/ilyatregubov/moodle 2021-09-22 19:47:28 +02:00
arjun-kallapur
a5ab9e466e MDL-66549 grades: Double arrow sort order should be ascending first 2021-09-22 14:13:14 +02:00
Luca Bösch
1f7fbed812 MDL-71352 gradereport_grader: Add icons for pass/fail. 2021-09-17 13:54:41 +02:00
Eloy Lafuente (stronk7)
9f9fe79c26 MDL-72589 behat: Add @skip_chrome_zerosize to failing scenarios
All the scenarios failing with Chrome zero-size errors are
getting the @skip_chrome_zerosize to be able to keep them apart from
regular runs. See MDL-71108 for more information about
that error.

They will be run by another job, specifically using that tag to
keep them failing and under control.
2021-09-15 20:25:11 +02:00
Luca Bösch
aa9a591ecd MDL-70433 grades: prevent double escaping in titles 2021-08-27 10:56:20 +02:00
Andrew Nicols
530322e2ce MDL-69918 core: Update uses of legacy form change checker 2021-08-10 23:54:01 +08:00
Andrew Nicols
776f4bd80c MDL-72179 behat: Make use of page resolvers 2021-07-26 15:14:28 +08:00
Ilya Tregubov
4819625349 MDL-32103 completion: Allow instant completion updates.
For activity based course completion criteria allow instant
course completion updates if the activity completion state was changed
for a single user.
2021-07-13 12:07:53 +02:00