-
-
Save ctian1/eee4c0fc5baf669a1a79b11de7a49ece to your computer and use it in GitHub Desktop.
Get the top contributor on piazza class
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
var delay = 500; | |
var regex = /\?cid=(\d+)/; | |
var results = {}; | |
$(".instructor_endorsed_sr").each(function(i, o) { | |
var iid = setTimeout(function(){ | |
o.click(); | |
// On threads with multiple answers, only first person gets credit? | |
var name = $("#s_answer .post_region_actions .user_name").first().text() || "Anonymous"; | |
var cid = regex.exec(window.location.search)[1]; | |
console.log(name + ", " + cid); | |
results[name] = results[name] ? (results[name]+1) : 1; | |
window.clearTimeout(iid); | |
}, i*delay); | |
}); | |
console.log(results); | |
// var sortable = []; | |
// for(var name in results) { | |
// sortable.push([name, results[name]]); | |
// } | |
// sortable.sort(function(a,b){return b[1]-a[1]}); | |
// console.log(sortable); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment