Skip to content

Instantly share code, notes, and snippets.

@brittanydionigi
Last active January 4, 2016 20:50
Show Gist options
  • Save brittanydionigi/8677242 to your computer and use it in GitHub Desktop.
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
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;
}
@gmeluski
Copy link

magic numbers. magic numbers everywhere...

@jennschiffer
Copy link

this is art

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment