moodleou / moodle-qtype_varnumunit

Moodle variable numeric sets question type with units.
0 stars 7 forks source link

Additional variable variants & answers not stored #9

Open ewalgran opened 1 year ago

ewalgran commented 1 year ago

We have been testing the Variable numeric set with units qtype_varnumunit 1.8 for Moodle 3.11+ version 2022050300 on a Moodle 4.1 instance.

  1. When trying to define calculated variables beyond the default 5 variants that are available the additional variants are not generated/stored. This issue occurs after using the "Recalculate now" function.
  2. When trying to included additional numerical answer options those are not stored either. This issue occurs when saving the question.

The fields are present and the elements can be configured but the data is wiped after calculating or saving. We will note issue 1 is also present in the qtype_varnumericset as well.

Below are a few javascript errors that appear that may or may not be related.

Screenshot 2023-03-24 at 8 53 43 AM

Side question is there an updated version of the qtype_varnumericset for 4.1 on the horizon? If so is there an estimated time for that?

timhunt commented 1 year ago

This works for me.

image

The error you get makes me think that the problem is not with this plugin. The error mentions react, but Moodle does not use react. Is it possible you are using a custom theme, which somehow causes problems for this question type?

ewalgran commented 1 year ago

Thanks for the follow up!

The issue does not occur with the Predefined variable option, we were able to have success with that as you confirmed. The error occurs when trying to generate a single Calculated variable beyond 5 variants. I am using the a=rand_int(1,00) formula to define these calculated variables.

Setup screenshot

Screenshot 2023-03-29 at 11 29 58 AM

Post Recalculate

Screenshot 2023-03-29 at 11 30 55 AM

We are using a base 4.1 test instance with no custom theme applied at this time but perhaps the default 4.1 theme is introducing this?

timhunt commented 1 year ago

Just showing blanks does not add variants. With this question type, you must add at least one variable with Predefined variants, to control how many variants there are. (If necessary add an otherwise unused variable called variant_number with values 1, 2, 3, 4, ...

(Really, the form validation and help should make this clear.)

ewalgran commented 1 year ago

Understood, thanks for verifying the requirement of a Predefined variant to allow for additional Calculated ones!

Circling back on the second issue we encountered that when trying to include additional numerical answer options those are not being stored. This issue occurs after using the "Save changes" button and then returning to edit it. I did verify that the qtype_varnumericset does successfully save multiple answer options.

Initial Question Setup with 2 answers Screenshot 2023-04-03 at 8 31 41 AM

Post Saving Question only 1 answer remains Screenshot 2023-04-03 at 8 32 17 AM

When additional answer options are added those too are wiped after saving the question, only one answer option remains. Can you replicate this issue or is this also an intended behavior for qtype_varnumunit?