Skip to content

Instantly share code, notes, and snippets.

@Matoex
Created June 23, 2023 13:06
Show Gist options
  • Save Matoex/dac97fa91d8343cc42f1cd7f380da6be to your computer and use it in GitHub Desktop.
Save Matoex/dac97fa91d8343cc42f1cd7f380da6be to your computer and use it in GitHub Desktop.
Studon %
/*
Calculates the % of the achieved points on studon accounting for only the rated exercises
*/
erreicht = Array.from(document.querySelectorAll(".ilTag")).map(x => x.innerText).map(x=>parseFloat(x.split(" ")[1])).reduce((a,b)=>a+b)
maxSumme = Array.from(document.querySelectorAll(".ilExcAssignmentHead")).filter(x=>x.children[1].children.length > 0).map(x=>parseFloat(x.outerText.split("max. ")[1].split(" ")[0])).reduce((a,b)=>a+b)
erreicht + "/"+maxSumme+"="+Math.round((erreicht/maxSumme)*1000)/10 + "%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment