4584 Commits

Author SHA1 Message Date
Tim Hunt
39abc01197 MDL-74752 question regrading: implement the required hooks
This commit implements the necessary core hooks to ensure we only
allow a regrade of a quetion attempt to take place if the new and old
versions of the question are sufficiently similar.

It will be followed by commits to each question type where the
new method needs to be implemented.

Automated tests will be included in the first of those (mulitple choice)
becuse we need a question type that implements the hooks to test
the core changes.
2022-05-31 09:22:22 +01:00
Tim Hunt
2069c8d480 MDL-74883 question: fix question_attempt_step_subquestion_adapter typos
During the late stages of developing MDL-20636, some key concepts
in the code got renamed. However, at the time, this class was not
updated properly so updating it now.
2022-05-30 16:10:03 +01:00
Tim Hunt
aac5b47cea MDL-74041 quiz: use own size for paging the question bank 2022-05-04 11:01:44 +01:00
Tim Hunt
10e8ffe312 MDL-74041 question bank: page size should be 100 2022-05-04 10:34:34 +01:00
Ilya Tregubov
4a60e9733d Merge branch 'master-MDL-74427-v4' of https://github.com/golenkovm/moodle 2022-04-28 08:09:37 +06:00
Mikhail Golenkov
6a19223290 MDL-74427 question: Re-use get_real_question_ids_in_category() 2022-04-27 12:32:54 +10:00
Mikhail Golenkov
b0e09b34ae MDL-74427 question: Implement get_real_question_ids_in_category() 2022-04-27 12:32:54 +10:00
Eloy Lafuente (stronk7)
76f5445451 MDL-74510 upgrade: add the 4.0.0 separation line to all upgrade scripts 2022-04-22 18:45:10 +02:00
Ilya Tregubov
e39a1fff2c Merge branch 'MDL-74471-master' of https://github.com/junpataleta/moodle 2022-04-13 14:59:21 +06:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Tim Hunt
2e1a632302 MDL-74470 quiz: put back random Q description on the Question page
This got lost in the 4.0 question bank work.

We are trying to phase out qtype_random, that is where the old
code and lang strings for describing random questions is, so
OK to add back a call to it. When we get better qbank filtering
we can replace this again.

Note, the asserts in the Behat were copied from my 3.11, checkout,
to really verify we are restoring the previous behaviour.
2022-04-11 19:01:00 +01:00
Tim Hunt
a43f56836a MDL-74255 quiz: fix redo and regrade question version handling 2022-04-08 12:19:53 +01:00
Tim Hunt
5fff990e25 MDL-74255 quiz: clean up lots of stuff mainly in the tests
This fixes lots of stuff like outdated or incomplete PHPdoc comments
or test heler functions where the arguments don't have their types
declared.

A few more significant fixes, like places were a silly method
was used to get a context which was readily available.
2022-04-08 12:19:52 +01:00
Shamim Rezaie
af77f81522 Merge branch 'MDL-73874-master' of https://github.com/BruceGoodGuy/moodle 2022-04-08 12:38:55 +10:00
Khoa Nguyen Dang
c0e53d297f MDL-73874 Questions: Add new validation for Drag and drop into text 2022-04-07 17:27:23 +07:00
Sara Arjona
2496a8910c Merge branch 'MDL-74412-master' of https://github.com/lucaboesch/moodle 2022-04-06 15:59:55 +02:00
Luca Bösch
ac2e962f61 MDL-74412 question: Not every column needs pr-3 in question bank. 2022-04-05 16:16:23 +02:00
Víctor Déniz
a51d24c8a8 MDL-74330 lang: Replace modified strings in tests 2022-04-01 13:17:18 +01:00
Helen Foster
3719878cbf MDL-74330 lang: Import fixed English strings (en_fix) 2022-04-01 13:17:08 +01:00
Jun Pataleta
23b625340e Merge branch 'MDL-74295' of https://github.com/timhunt/moodle 2022-03-30 19:48:26 +08:00
Jake Dallimore
6b071a03db Merge branch 'MDL-73105' of https://github.com/paulholden/moodle 2022-03-30 13:54:11 +08:00
Paul Holden
949212ffda MDL-73105 qbank_managecategories: correct category edit URL. 2022-03-29 16:52:26 +01:00
Tim Hunt
d3ef035706 MDL-74295 question bank: add help icons to columns that need it 2022-03-28 09:33:02 +01:00
Eloy Lafuente (stronk7)
4344d4b55b Merge branch 'MDL-72958' of https://github.com/timhunt/moodle 2022-03-27 16:43:15 +02:00
Ilya Tregubov
7bedf54f5b Merge branch 'master_MDL-73763_index-fix' of https://github.com/catalyst/moodle-MDL-70329 2022-03-24 13:14:03 +06:00
Marc-Alexandre Ghaly
c3ac868bf7 MDL-73763 core : Index fixes for reference tables
This commit will add the index for the question_reference
and the question_set_reference table if its not already
added. This commit will also implement the logic of adding
the question area and component in the joins of the question
reference table in order to make sure any other plugin using
the qbank api does not conflict with each other.
2022-03-24 18:04:47 +11:00
Tim Hunt
ee80bc47b7 MDL-72958 questions: tidy up all question-related upgrade.txt files 2022-03-22 14:53:43 +00:00
Luca Bösch
96581087a9 MDL-74091 core_question: 'table-responsive' qtable avoids overlap. 2022-03-22 14:19:42 +01:00
Eloy Lafuente (stronk7)
337dea4afa Merge branch 'MDL-69078-better-error-message-for-wrong-encoding' of https://github.com/ziegenberg/moodle 2022-03-17 22:22:03 +01:00
Daniel Ziegenberg
f942a5cedd
MDL-69078 questions: check for UTF-8 encoding of the import file
Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2022-03-17 20:53:50 +01:00
Jun Pataleta
e2e048d49a Merge branch 'MDL-73597-master' of https://github.com/HuongNV13/moodle 2022-03-17 15:50:36 +08:00
Huong Nguyen
0c33dbb2ed MDL-73597 Questions: Form checker integration for D&D question types 2022-03-16 16:09:56 +07:00
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