Skip to content

Instantly share code, notes, and snippets.

@DanielMSchmidt
Last active January 1, 2016 06:19
Show Gist options
  • Save DanielMSchmidt/8104511 to your computer and use it in GitHub Desktop.
Save DanielMSchmidt/8104511 to your computer and use it in GitHub Desktop.
If you paste this script into your chrome developer console or firebug console while visiting the StudiDB of the CAU you get the weighted grade point average.
(function(){
var rows = document.querySelectorAll('tr');
var row, note, module, ects, sumects = 0, summe = 0, divisor = 0;
var base = ["Inf-Math-A", "Inf-Prog", "Inf-DigiSys", "Inf-DSys", "Inf-EinfPP", "Inf-ADS", "Inf-OAR", "Inf-Math-B", "Inf-PP"];
for(var i = 0, len = rows.length; i < len; i++){
row = rows[i];
module = row.querySelectorAll('.f1:nth-of-type(2)');
note = row.querySelectorAll('.f1:nth-of-type(3)');
ects = row.querySelectorAll('.f1:nth-of-type(4)');
if (note.length && ects.length){
note = parseFloat(note[0].innerHTML);
if (note < 5.0 && note > 0) {
module = module[0].innerHTML;
ects = parseFloat(ects[0].innerHTML);
sumects += ects;
for (var j = 0, len2 = base.length; j < len2; j++) {
if (module.indexOf(base[j]) !== -1) {
ects *= 0.5;
}
}
summe += note * ects;
divisor += ects;
}
}
note = ects = undefined;
}
console.log("Dein Schnitt: %.2f bei %d ECTS und %d Klausuren", summe/divisor, sumects, rows.length);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment