Created
July 23, 2014 13:35
-
-
Save vladson/14c4aedd650da72a706b to your computer and use it in GitHub Desktop.
Coursera quiz computer
This file contains 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
grades = _.map($('.course-quiz-item-score > td >span'), | |
function(i){ | |
return _.map($(i).clone().children().remove().end().text().split(' / '), | |
function(j){return Number.parseFloat(j)});}); | |
pos = _.reduce(grades, function(memo, i){ return memo + i[1]}, 0) | |
got = _.reduce(grades, function(memo, i){ return memo + i[0]}, 0) | |
result = got / pos | |
alert('You got ' + result*100 + '% till now') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment