Calculated Qn - Decimal Places - Bug?

Calculated Qn - Decimal Places - Bug?

by Andrew G -
Number of replies: 15

[Moodle 2.2]

Dear Forum,

I'm creating calculated questions and only want students to submit responses to 2 decimal places - so have selected the '2 decimal places' option.  However, the qn type accepts >2 decimal places!  Is this a bug? 

Regards,

A

Average of ratings: -
In reply to Andrew G

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -
Hi Andrew
This is not a bug but an "historical" feature.
The main objective of the calculated question grading is to check if the student response is inside the tolerance limits set for a given answer (using the unit value) . The decimal places settings are used to display the response correctly.
Adding fomat grading either significant figures or correct decimal point ( . or ,) will complexify an already complex question editing interface.
Pierre
In reply to Andrew G

Re: Calculated Qn - Decimal Places - Bug?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You might also want to look at the 'varnumeric' question type in the plugins database. That can grade the number of significant figures.

In reply to Tim Hunt

Re: Calculated Qn - Decimal Places - Bug?

by Andrew G -

Dear Pierre/Tim,

thanks for your responses.  However, I'm still puzzled.

I'm happy with the grading of the questions as these work fine within the tolerances set.  However the student display of the correct answers do not conform to the question settings. The questions are set to: 'correct answer shows 2' (see pic below).

This doesn't seem to have any effect on the way the correct answers are displayed, where the example below shows 12 decimal places. The question will mark the answers to 2 decimal places but the feedback shows 12 places.

Part of the assessment is to ensure students can round their answers and so provide precise data within given parameters (ie. correct to n decimal places). The way it currently functions could potentially be confusing for students as we are asking them to provide answers to 2 decimal places but the feedback provides answers to more than 2.

 Thanks.

In reply to Andrew G

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -
This appears to be a bug.
Could you specify with Moodle version you are using ?
Pierre
In reply to Pierre Pichet

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -

This is a bug as I checked on Moodle Demo site.

Will create a new bug if necessary.

Pierre

In reply to Pierre Pichet

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -
Hi Andrew, The bug is MDL-31680, I had started to work on it some months ago. Your comments remind me to put it at an higher priority on my todo list. Pierre
In reply to Andrew G

Re: Calculated Qn - Decimal Places - Bug?

by James Roberts -

I have to agree that this is an irritating (but non-fatal) bug.  I am using an algorithm that estimates the normal distribution accurately to about 3 decimal places.  Unfortunately, students will see a "correct answer" to 16 decimal places that is not correct.  It would be nice if I could truncate the reported answer.

In reply to James Roberts

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -

Use the  round(your equation,3) function that will round the result to 3 decimals and set the format to 3 decimals.

This should work.

Pierre

Average of ratings:Useful (1)
In reply to Pierre Pichet

Re: Calculated Qn - Decimal Places - Bug?

by James Roberts -

Thanks Pierre, that worked!

The only downside is that my formula is now even longer and more complex . I wish that the text box (for the answer to calculated questions) had a greater width so that I could see more of the formula.

In reply to James Roberts

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -

Me too,  wink this is MDL-31056 also on the drawing board.

Some other bugs need to be resolve before because if I allow longer equation the rendering of dataitems needs to be modified which leads me to find problems in handling the numerical values (MDL-31680) and ...

Pierre

 

In reply to Pierre Pichet

Re: Calculated Qn - Decimal Places - Bug?

by James Roberts -

Pierre (or anyone else), any solution/workaround to the following problem would be appreciated.

While the round({x},decimal places) function establishes a maximum number of decimal places, it doesn't establish a minimum number.  So, for example, round(2.3, 2) will return 2.3 and not 2.30.  I use calculated questions in Moodle for financial problems and I would like to have dollars and cents sometimes.  $2.3 looks strange to students although it is mathematically identical to $2.30.

In reply to James Roberts

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -

Hi James,

The case of rounding does not work when the last decimal is 0, the rounding function eliminates the 0.

However if ypou add a smaller decimal than your rounding you will have the display you want.

i.e. round(8.8+0.00000001, 2) = 8.80

If your number is small, the probability that it could result to a 0 becomes very small .(in this example something smaller than 1 in 1000000.

Pierre

 

In reply to Pierre Pichet

Re: Calculated Qn - Decimal Places - Bug?

by James Roberts -

Pierre,

I tried your suggested work around.  (IOW, I tried adding a small decimal - eg. 0.0002 to a number and then rounding to two decimal places).  It doesn't work.

In simple terms, students see 8.3 as the correct answer to a question that should appear as $8.30.  (Money is already a confusing concept ... )

In reply to James Roberts

Re: Calculated Qn - Decimal Places - Bug?

by Pierre Pichet -

Hi James,

A more laborious solution is to display all the datasets and change the values so that the response does not contain 0 as final digits i.e. 8.00 or 8.30.

Pierre

In reply to Pierre Pichet

Re: Calculated Qn - Decimal Places - Bug?

by James Roberts -

Pierre,

I realize that this is an old thread but since I stumbled upon it, and I have often learned alot about Moodle from old threads, I thought that I would add a few points.

First, I now do as you suggest above: I now check the values of wild cards that represent prices to ensure that they don't finish in 0. For example, I edit any number such as 8.30 and change it to 8.35 or change 10.70 to 10.75 etc. (BTW, it's not that laborious for anyone who does accounting.... but alot of my prices finish with a nickel or with a 5!)

Second, it took me time to understand that I can change/edit the value of a "wild card" after Moodle has first inserted a specific value. ("Preset" might be a better term/definition rather than "wild card" - since the values are not really random but can be edited later.)  That is to say: I now recommend to colleagues to add only one value to a wild card on first creating a calculated question, and then add more values later.

Anyway, thanks for your various posts Pierre.