Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix QuizTextHandler.makeCorrection() when the correct answer is 0 #132

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open

Fix QuizTextHandler.makeCorrection() when the correct answer is 0 #132

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jun 21, 2016

makeCorrection() should first check whether the user's answer is exactly
the same as the correct answer. This fixes the issue that the user's
answer would always be marked incorrect if the correct answer was 0,
because the division-by-0 in the relative error calculation would produce
NaN.

For example:
http://bcaffo.github.io/courses/06_StatisticalInference/homework/hw4.html#6
Enter '0' for the answer to #2 and click "Submit". The red 'X' icon would
appear next to the text box. Next click "Show Answer" and "OK" on the
pop-up. The correct answer is 0 and the green checkmark icon is now shown
next to the text box for #2.

makeCorrection() should first check whether the user's answer is exactly
the same as the correct answer. This fixes the issue that the user's
answer would always be marked incorrect if the correct answer was 0,
because the division-by-0 in the relative error calculation would produce
NaN.

For example:
http://bcaffo.github.io/courses/06_StatisticalInference/homework/hw4.html#6
Enter '0' for the answer to #2 and click "Submit". The red 'X' icon would
appear next to the text box. Next click "Show Answer" and "OK" on the
pop-up. The correct answer is 0 and the green checkmark icon is now shown
next to the text box for #2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant