Last active
January 4, 2016 20:50
-
-
Save brittanydionigi/8677242 to your computer and use it in GitHub Desktop.
nothing's right I'm torn I'm all out of faith this is how I feel I'm cold and I am shamed
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
points_to_award: function(questionPosition, inputVal, correctVal) { | |
var points_earned, plus_seven, plus_three, plus_one; | |
switch (questionPosition) { | |
case 2: | |
plus_one = (inputVal >= (correctVal - 5) && inputVal <= (correctVal + 5)) ? 1 : 0 | |
plus_three = (inputVal >= (correctVal - 3) && inputVal <= (correctVal + 3)) ? 3 : plus_one; | |
break; | |
case 10: | |
plus_one = (inputVal >= (correctVal - 3) && inputVal <= (correctVal + 3)) ? 1 : 0 | |
plus_three = (inputVal >= (correctVal - 2) && inputVal <= (correctVal + 2)) ? 3 : plus_one; | |
break; | |
case 18: | |
plus_one = (inputVal >= (correctVal - 7) && inputVal <= (correctVal + 7)) ? 1 : 0 | |
plus_three = (inputVal >= (correctVal - 3) && inputVal <= (correctVal + 3)) ? 3 : plus_one; | |
break; | |
} | |
plus_seven = (inputVal === parseInt(correctVal)) ? 7 : plus_three; | |
points_earned = (!inputVal) ? undefined : plus_seven | |
return points_earned; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
magic numbers. magic numbers everywhere...