sakaicontrib / mneme-project

Etudes Mneme Tool and additional projects.
0 stars 6 forks source link

Incorrectly marked answers when using numerical questions and with 'any order' #27

Open austin48 opened 5 years ago

austin48 commented 5 years ago

What is your favorite number: {3568} Pick a number 3 or 4: {3|4}

What is your favorite number: 3,568 Pick a number 3 or 4: 3

austin48 commented 5 years ago

The reason the {3|4} question fails is because earlier there's a question with {3568}, but when you answer it with a thousands place comma "3,568", because the question type is "numerical" (vs text), mneme, will convert the comma into a decimal point because it assumes commas are decimal separators (which is common in other countries), so the answer becomes 3.568. Then it searches through ALL of the possible answers in the test and because 3.568 is in the range of {3|4}, it marks the answer correct... which is wrong (but a coincidence) because it should have validated it agains {3568}. Then, because it found a match (again an incorrect one), it removes the {3|4} answer from the list of possible answers... so when the actual answer for the {3|4} fill in the blank is evaluated, that {3|4} is no longer in the list of possible answers so it fails and marks it incorrect!

austin48 commented 5 years ago

I believe the issue is happening in FillBlanksAnswerImpl.java (line 202)

// allow dot or comma for decimal point
// TODO: this needs to be changed to respect locale, not just replace commas! -ggolden
answer = answer.replace(',', '.');
correct = correct.replace(',', '.');

and possibly also in FillBlanksQuestionImpl.java (line 1038)

// allow dot or comma for decimal point
// TODO: this needs to be changed to respect locale, not just replace commas! -ggolden
answer = answer.replace(',', '.');