webexercises
webexercises copied to clipboard
allow decimal comma for numeric with tolerance
I'm using webexercises
for my interactive math exercises. As the exercises is in German many students use a decimal comma rather than a decimal point. So to allow for this as being correct I have adapted the webex.js
code to replace ,
with .
prior to checking the tolerance:
my_answer = my_answer.replace(/,/g, '.');
As this is only done if there is a tolerance, I felt that the replacement could be done without further conditions (e.g., adding a class). This is also the behavior of most learning management systems like Moodle etc.
If there is no tolerance, then the answer is likely an integer anyway, so I have not tried to address that case. Not sure whether that might be relevant for some use cases.