Created
July 28, 2020 13:16
-
-
Save onmax/671ec826554982e3dd3ebced5d3f1e90 to your computer and use it in GitHub Desktop.
Small JS script to obtain your mean grade using the UPM page
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
// First you need to click the button to show your grades. | |
// Then open the console using F12 and copy and paste the following code | |
const tables = document.querySelectorAll("table#tabla_expediente") | |
let acc = 0 | |
let sum = 0 | |
tables.forEach(t => { | |
Array.from(t.rows).forEach(r => { | |
const col = r.cells[r.cells.length - 1] | |
matches = /\((\d+\,*\d*)\)/gm.exec(col.innerText); | |
if(matches !== null) { | |
const grade = parseFloat(matches[1].replace(',', '.')) | |
if (grade >= 5) { | |
acc += 1 | |
sum += grade | |
} | |
} | |
}) | |
}) | |
console.log("Tu media es de:", sum / acc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment