Found Bug in calculated question type

Found Bug in calculated question type

by Amrata Ramchandani -
Number of replies: 2

Consider the scenario where I put the formula for correct answer as log(1-{a}).

In the default data set at page 3 it evaluates for the value of {a} from the range 1 to 10 which gives us NaN. Inspite of changing the range for e.g 0.1 to 1,which will give us some determinate value, we are not able to add the data sets because it again internally evaluates the expression for the value of {a} ranging from 1 to 10.

Below are the screenshots for the same thing which I am trying,which will help in understanding the scenario in a better way.

1) Default Values taken for evaluation of the given formula which results in NaN.



2) After updating the data range 


things are fine till here,but the bug arises when I hit Add item or display item,check below screenshot.


As you can see,on clicking add item,although the range is updated to 0.1 to 1, while evaluating it takes the value of wild card from the default range only.Because of this bug we are not able to add any data set in the question.

The workaround which helped us was :

First write the formula which doesn't gives us NaN for e.g log(1+{a}) , add at least 1 correct data item for this formula then edit the question back to log({1-{a}),through this at least we are able to add data sets.


Average of ratings: -
In reply to Amrata Ramchandani

Re: Found Bug in calculated question type

by P Sunthar -

One way to circumvent this is to use a modified syntax for the question type.  We could consider this suggestion:
  https://moodle.org/mod/forum/discuss.php?d=365971 

If there is interest, IIT Bombay's Moodle team will be happy to work on this (both, fixing the above bug and an interpreter for the suggested syntax).



In reply to P Sunthar

Re: Found Bug in calculated question type

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello P Sunthar and Amrata,

You may want to have a look at the "Formulas" question type, an excellent third party plug-in. The Formulas question has all the required scientific functions and you can easily generate random questions with arrays, etc. Documentation is available at http://http://35.193.77.29/course/view.php?id=22 (login: 'student', password: 'Moodle2018#'. Do not hesitate to ask questions about this question type.