Zeroes being removed from calculated question type wildcards

Zeroes being removed from calculated question type wildcards

oleh Sami Soinio -
Jumlah balasan: 4

While transferring questions from one institution to another, our lecturer noticed that in our Moodle the calculated question type automatically removes zeroes from the end when saving wildcard variables. This is problematic as In certain fields zeroes are meaningful. One might think this is just how the question type works, but I have tested this on two other Moodle installations separate from our institution in which the zeroes are not removed when saving. Our installation of Moodle is pretty much plain vanilla, which is making the issue quite complex and my guesses for the reasons behind this vary from Moodle installation types to server language issues that might define the decimal separator type (comma and period).

Our installation:

Steps to reproduce:

  1. Get to the page 'Edit the wildcards datasets' with the calculated question type
  2. Add a number with zeroes (e.g. 3.800) to 'Item to add -> Wild card {X}
  3. Update the dataset parameters
  4. Check the answers tolerance parameters if the zeroes have been removed (3.8) or remained (3.800) 
Rata-rata penilaian: -
Sebagai balasan Sami Soinio

Re: Zeroes being removed from calculated question type wildcards

oleh Dominique Bauer -
Gambar dari Documentation writers Gambar dari Particularly helpful Moodlers Gambar dari Plugin developers

Hello Sami,

(Moodle 3.9) Unfortunately, it seems that the "trailing zeros" of wild card values are always removed and that they cannot be displayed.

See the example below:







Sebagai balasan Dominique Bauer

Re: Zeroes being removed from calculated question type wildcards

oleh Dominique Bauer -
Gambar dari Documentation writers Gambar dari Particularly helpful Moodlers Gambar dari Plugin developers

Hello Sami,

As I mentioned in my first post, wild card values can be displayed with a given number of decimal places, not with a given number of significant digits. In addition, trailing zeros are not displayed.

The Calculated question has a very good algorithm for displaying a numeric value with the desired number of decimal places or the number of significant figures, including trailing zeros. Unfortunately, this algorithm is only applied for displaying answers, as shown below.

In my opinion, this problem could be considered a bug, at least an oversight, and should be reported in the Tracker.


Formulas_20200728_1507.png

Sebagai balasan Dominique Bauer

Re: Zeroes being removed from calculated question type wildcards

oleh Sami Soinio -

Thank you for taking the time to look into this matter. Testing the trailing zeroes on a separate Moodle installation that I have access to (ver. ~3.7/8), the trailing zeroes remain after I add them manually. This is also true on another installation at a different institution. However, in our installations (live 1&2 and test), the trailing zeroes disappear.

Trailing zeroes on a wildcard


Trailing zeroes on a wildcard

Sebagai balasan Sami Soinio

Re: Zeroes being removed from calculated question type wildcards

oleh Dominique Bauer -
Gambar dari Documentation writers Gambar dari Particularly helpful Moodlers Gambar dari Plugin developers
Hello Sami,

I doubt it's the browser. I observe the same behavior with Chrome and Firefox. The problem is probably due to the version of PHP or to one of the software making up the server, LAMP or other.

Trailing zeros are often problematic. A solution seems to have been developed for the display of answers. If I were you, I would put my efforts to try and have the same solution applied for the display of wild card values in the question text. A developer will have to look into this.