Skip to content

Instantly share code, notes, and snippets.

@onmax
Created July 28, 2020 13:16
Show Gist options
  • Save onmax/671ec826554982e3dd3ebced5d3f1e90 to your computer and use it in GitHub Desktop.
Save onmax/671ec826554982e3dd3ebced5d3f1e90 to your computer and use it in GitHub Desktop.
Small JS script to obtain your mean grade using the UPM page
// 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