Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arnlaugsson/88e59d7f3e800f67b027d4c5c9b9cb00 to your computer and use it in GitHub Desktop.
Save arnlaugsson/88e59d7f3e800f67b027d4c5c9b9cb00 to your computer and use it in GitHub Desktop.
To extract Peer Review participation from Canvas, using the DevTools and a bit of javascript.
/*
To extract Peer Review participation from Canvas
0. Navigate to an assignment's peer review page
1. Open up your favorite DevTools (in Chrome for example).
2. Copy and past the following code snippet into the DevTools console.
3. Right click on the object in the console and click "Store as a global variable"
4. The output will show the variable name given (for example "temp1"), type into the console: "copy(temp1)" and paste the output into your favourite editor.
5. You will have to format the output to match CSV format, but then you can paste it into Excel for furhter processing.
Author Skúli Arnlaugsson (@arnlaugsson), Academic Free License v3.0.
*/
let lines = ["Student number, Student name, Peer review status"];
let i = 1;
document.querySelectorAll(".student_reviews").forEach(function (review) {
let student_name = review.querySelectorAll("a")[0].innerText;
let status_message = review.querySelectorAll(".peer_review")[0];
let status = "None assigned";
if (window.getComputedStyle(status_message).display === "none") {
status_message = review.querySelectorAll(".peer_review")[1];
status = status_message.querySelectorAll(
".pull-left > .screenreader-only"
)[0].innerText;
}
lines.push(i + ", " + student_name + ", " + status);
i++;
});
lines;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment