Created
February 2, 2015 21:24
-
-
Save theo-bittencourt/56fb4dc7d0a12f433907 to your computer and use it in GitHub Desktop.
Quiz Score
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
value = | |
if answer.seconds <= 3 | |
Question::BASE_SCORE_VALUE | |
else | |
# Value is proportional to time taken to answer the question. | |
Question::BASE_SCORE_VALUE * (1 - (answer.seconds.to_f / Question::MAX_TIME_TO_ANSWER)) | |
end | |
# Double value if question is bonus | |
value * (answer.question.bonus? ? 2 : 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment