Skip to content

Instantly share code, notes, and snippets.

@jewlofthelotus
Created May 16, 2013 14:00
Show Gist options
  • Save jewlofthelotus/5591940 to your computer and use it in GitHub Desktop.
Save jewlofthelotus/5591940 to your computer and use it in GitHub Desktop.
Adjusting the level calculation for 3 ranking levels.
// Calculates knowledge level based on number of correct answers
calculateLevel: function(correctAnswers) {
var percent = (correctAnswers / questionCount).toFixed(2),
level = 0;
if (plugin.method.inRange(0, 0.330, percent)) {
level = 3;
} else if (plugin.method.inRange(0.331, 0.660, percent)) {
level = 2;
} else if (plugin.method.inRange(0.661, 1.00, percent)) {
level = 1;
}
return level;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment