Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
Including in this commit:
- Added a new counter called attemptsavailable for ad-hoc task
- PHPUnit test for the new feature
The new quick form field uses a choice list to display a dropdown
component inside a form. Apart from que quick form code, the patch also
include a small improvement to the choicelist class to disable empty
values. This small patch is needed because the quickform field won't
allow empty values.
Add new features to the dropdown components (dialog and status) needed
for using them in quick forms. Now the dialog dropdown have methods to
disable the dropdown button (to disable the field). The status dropdown
has one minor style bugfix and the selected item styles are now stored
as a data attribute.
* First parameter should be the field name that the format property
points to.
* No need for VALUE_REQUIRED since it's the default for the $required
parameter.
* Third parameter is the default value and not a description string.
* 'Content format' is passed to the $default parameter which is
incorrect.
* Also removed passing of VALUE_REQUIRED because it's already the
default value for the $required parameter.
- If a text format property defines the 'optional' attribute as true,
then the $required parameter that
is passed to \core\external\exporter::get_format_structure() should be
VALUE_OPTIONAL.
- If a default value is provided for a format property,
\core\external\exporter::get_format_structure() should pass the default
value to the external_format_value constructor.
- Added validation for external_format_value for the default parameter.
Debugging will be shown in case an invalid default value is passed.
- Amended unit tests for better coverage.
Since 4be39296 the root HTML element contains the iso6391 language
code of the current language pack. However various JS modules need
access to the original Moodle language pack code, so expose that
in the `M.cfg` structure.
The curent patch revealed a bug inside set_matrix_power_levels
where returned user power levels contained an array of objects.
Other methods were failing and giving incorrect responses
as they were expecting arrays.
When xdebug is set to break on exceptions it stops on all exceptions,
including _caught_ exceptions.
As a result we regularly hit this uniqid helper issue if debugging with
xdebug.
The solution is to check if the helper exists using the hasHelper method
instead of catching an exception when it does not exist.
This random error was caused because when reviewing an attempt,
the first pageid to display is calculated based on the timeseen
field in the lesson_attempst table.
In Oracle, sometimes it returned the second pageid (because both
had the same timeseen), so which led to these random failures.
Apart from adding 1-second wait when the attempt is created (to
guarantee the first page is returned properly), a few more
improvements have been also made, like removing manual steps for
setting the lesson activity or adding some extra checks to
confirm the information displayed is expected.