4452 Commits

Author SHA1 Message Date
Sara Arjona
a26f985cae Merge branch 'MDL-74130' of https://github.com/timhunt/moodle 2022-03-15 12:19:10 +01:00
Tim Hunt
85c0b1d2fa MDL-74130 question behat: Update tests to use the new navigation steps 2022-03-14 22:13:04 +00:00
Tim Hunt
d54bef46f1 MDL-74130 question behat: support I am on ... page or key qbank pages 2022-03-14 22:13:04 +00:00
Tim Hunt
9c65fe8b8f MDL-74130 question behat: rename behat_question -> behat_core_question
This is the expected naming for a Behat file for a core component.

Note, there are no acutal references to the deprecated class name
in core, but there might be in plugins, so we added a
backwards compatibility class with the old name. Thanks to
Andrew Lyons for hints about how to do that.
2022-03-14 22:13:04 +00:00
Jun Pataleta
def7df4825 Merge branch 'master_MDL-72890_quiz-regrade' of https://github.com/catalyst/moodle-MDL-70329 2022-03-14 14:19:56 +08:00
Jun Pataleta
2431f7bff8 Merge branch 'MDL-71305-master' of git://github.com/rezaies/moodle 2022-03-11 11:51:00 +08:00
Víctor Déniz
f4d27bd04c MDL-54724 qtype_multianswer: fix version.php 2022-03-11 00:05:18 +00:00
Víctor Déniz
9a0a05ef39 Merge branch 'MDL-54724-master' of https://github.com/cameron1729/moodle 2022-03-10 23:21:24 +00:00
Shamim Rezaie
bc8bf406c8 MDL-71305 core_question: Use toggle button for flag question element 2022-03-08 13:45:18 +11:00
Shamim Rezaie
a9d8207da9 Merge branch 'MDL-73824' of https://github.com/stronk7/moodle 2022-03-05 00:39:29 +11:00
Marc-Alexandre Ghaly
3e09319e7a MDL-72890 core_question : Question regrade for question versions
This commit implements a question regrade for the selected
version in the quiz for a slot.

Co-Authored-By: Safat Shahin <safatshahin@catalyst-au.net>
Co-Authored-By: Tim Hunt <tim.hunt@open.ac.uk>
2022-03-04 23:06:50 +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
Jun Pataleta
c9d466cb80 Merge branch 'MDL-73799' of https://github.com/stronk7/moodle 2022-03-04 14:47:39 +08:00
Sara Arjona
4495182ac5 Merge branch 'MDL-72915-master' of https://github.com/HuongNV13/moodle 2022-03-03 17:30:54 +01:00
Eloy Lafuente (stronk7)
b3c4bd6250 MDL-73799 phpunit: Move some test names, as agreed in the issue
- behaviourtype_test => behaviour_type_test (10)
- questiontype_test => question_type_test (16)
- upgradelibnewqe_test => upgrade_old_attempt_data_test (13)
2022-03-03 12:22:36 +01:00
Eloy Lafuente (stronk7)
68b4a13cec MDL-73799 phpunit: various question & quiz testcase names
To all the walkthrough, questiontype, question, upgradelibnewqe,
behaviourtype_test and edit_form 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 component and being valid api:
  - form related tests have been moved to tests/form subdir.
2022-03-03 12:22:36 +01:00
Safat Shahin
cceabf651f MDL-71636 qbank_columnsortorder: unit and behat test fix 2022-03-02 11:26:36 -05:00
Andrew Nicols
9331de13ab MDL-71636 qbank_columnsortorder: Fix issues identified during integration 2022-03-02 20:18:41 +08:00
Andrew Nicols
b15051a55f Merge branch 'MDL-71636' of https://github.com/timhunt/moodle 2022-03-02 19:56:24 +08:00
Cameron Ball
53d3843955 MDL-54724 qtype_multianswer: Better handle corrupted questions
When questions are deleted, we now check if the parent is in use before deletion.

Prior to this, it would be possible for multianswer questions to reference
questions that have been deleted. This results in fatal errors when the quiz
is viewed.

This patch uses a dummy 'subquestion_replacement' to handle this case and
display some information to the end user about what has happened so that
they may take action to repair the corrupted question.

As a result of the bug described above, the sequence column of
mdl_question_multianswer can contiain references to questions that no
longer exist, and these IDs can make their way in to backups.

When this happens, the backups cannot be restored. To avoid this,
this patch skips trying to restore those questions that reference
question IDs that no longer exist (as there is no way to recover them).
2022-03-02 17:12:19 +08:00
Marc-Alexandre Ghaly
6dc1084c47 MDL-71636 qbank_columnsortorder: Add a columnsortorder settings page
This implementation will introduce a feature "columnsortorder"
which will add the column sort order feature in an external page.
Having this feature will give users the flexibility of sorting plugin
columns in the question bank view.
2022-03-02 09:08:50 +00:00
Marc-Alexandre Ghaly
7c016b3451 MDL-71636 core_question : API changes for column_base
This commit implements methods visibility changes to column_base class
and its child classes.
2022-03-02 08:14:48 +00:00
Eloy Lafuente (stronk7)
9dde12dc99 Merge branch 'MDL-72092-master' of https://github.com/Chocolate-lightning/moodle 2022-03-01 14:55:02 +01:00
Ilya Tregubov
47e880e347 Merge branch 'master_MDL-72448-qank_history' of https://github.com/catalyst/moodle-MDL-70329 2022-03-01 13:49:19 +02:00
Mathew May
b0532aedd8 MDL-72092 behat: Add private files block where needed 2022-03-01 19:13:20 +08:00
Safat Shahin
6c923f4bf0 MDL-72448 qbank_history: Add history plugin to core
This implementation will introduce history plugin to
show the versions of a question. This plugin uses the
actual qbank api to implement the feature.
2022-03-01 14:39:51 +11:00
Bas Brands
dd95845bf1 MDL-73595 theme_boost: make tertiary nav more distinct 2022-02-28 13:07:52 +01:00
Jun Pataleta
baf360a7ba Merge branch 'MDL-73915-master-terser' of https://github.com/andrewnicols/moodle 2022-02-24 17:29:17 +08:00
Ilya Tregubov
be7a576994 Merge branch 'MDL-73335-tim' of https://github.com/ilyatregubov/moodle 2022-02-24 09:43:59 +02:00
Tim Hunt
2f9032a198 MDL-73335 quiz/questions: fix Behat fails from nav changes
The Classic quiz behat override is no longer needed.
The way it is implemented is Boost/core works in all cases.
2022-02-24 09:26:29 +02:00
Sujith Haridasan
b610055bbd MDL-73335 question: Add the tertiary nav for question bank
The tertiary navigation has been added to the question bank.
- Url selector has been added for the pages:
  Questions, Categories, Import and Export
- A separate page to "Add category" has been added.
  The "Add category" is available as a tertiary nav button.
- Updated the tests for the changes made.

This commit is mostly Sujith's work, with further changes by
Tim Hunt <T.J.Hunt@open.ac.uk> so we share the blame/credit.

AMOS BEGIN
 CPY [questioncats,mod_quiz],[questioncategories,core_question]
AMOS END
2022-02-24 09:26:29 +02: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
Eloy Lafuente (stronk7)
ea403ad70d Merge branch 'master_MDL-73778-oracle-behat-fix' of https://github.com/catalyst/moodle-MDL-70329 2022-02-22 17:23:27 +01:00
Safat Shahin
83e6b3d8d8 MDL-73778 mod_quiz: Oracle Manual grading scenario
This change will resolve Manual grading settings are
remembered as user preferences - failed behat test in
oracle.
2022-02-22 11:34:37 +11:00
Helen Foster
7ff6b2daef MDL-73812 lang: Import fixed English strings (en_fix) 2022-02-18 15:50:26 +00:00
Sara Arjona
18dc1db304 Merge branch 'master_MDL-73699-questionstatus-reviewchanges' of https://github.com/catalyst/moodle-MDL-70329 2022-02-17 17:08:53 +01:00
Marc-Alexandre Ghaly
a21764842c MDL-73699 qbank_editquestion: Question status UI/UX update
This commit implements a question status UI/UX change in the question bank page
from clickable popup link to dropdown following moodle UI/UX policy.
2022-02-17 08:46:30 -05:00
Sujith Haridasan
c4e411e48b Revert "MDL-71915 question: Update the behat tests"
This reverts commit f000755ba1f4357f1a4e697e7e72dcb752f1ce07.
2022-02-15 15:54:00 +00:00
Sujith Haridasan
73aeabab0b Revert "MDL-71915 question: Update the tertiary nav"
This reverts commit 26eabeccf40c3a5e40c593ff3f3b07fe6bf6f5bc.
2022-02-15 15:54:00 +00:00
Huong Nguyen
b5c181f117 MDL-72915 qtype_ddimageortext: Fix eventHandler for Unlimited items
Sometimes, for the question that has a lot of input groups and unlimited draggable items,
the 'clone' process takes longer than usual, so the questionManager.init() method
will not add the eventHandler for the cloned drag.
We should make sure to bind the eventHandler for the cloned too
2022-02-09 15:23:37 +07:00
Eloy Lafuente (stronk7)
3bb4a4009c MDL-73764 tool_xmldb: Regenerate all the files detected by the report
Note that, instead of going one by one to them from the XMLDB Editor
(load, makes some tiny change, save, revert the change, save), the
report includes a commented line that, once uncommented, does regenerate
the file while reporting.

I've left it there as a commodity for the developer.
2022-02-08 19:25:03 +01:00
Andrew Nicols
95c6d3c8d9 Merge branch 'MDL-73716' of https://github.com/stronk7/moodle 2022-02-08 10:59:34 +08:00
Eloy Lafuente (stronk7)
43280530b6 MDL-73716 phpunit: remove old simpletest static members
And replace them by phpunit @covers annotations including
all the classes declared or extended in the removed members.

It's not awesome coverage, but better than nothing.
2022-02-07 10:42:17 +01:00
Marc-Alexandre Ghaly
66115d7f0b MDL-73666 core_question: Question bank usage and comment modal fix
Fix for question bank modals not showing question images.
2022-02-07 08:37:05 +11:00
Sara Arjona
de83532bfa MDL-71696 question: Fix random PHPUnit error with question order 2022-02-04 18:10:35 +02:00
Sara Arjona
dc8b6a84a1 MDL-71696 question: Fix Oracle failures with ambiguous colum 2022-02-03 19:28:27 +01:00
Sara Arjona
b841a811be Merge branch 'master_MDL-71696-versioning-integration' of https://github.com/catalyst/moodle-MDL-70329 2022-02-03 13:25:27 +01:00