Created
May 15, 2019 18:02
-
-
Save stekern/7739ca39f56bfe01291a5e1fc5228892 to your computer and use it in GitHub Desktop.
Calculate GPA from StudentWeb
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
// This script will calculate your GPA according to your grades on StudentWeb. | |
// 1. Go to https://fsweb.no/studentweb/resultater.jsf | |
// 2. Open up your browser's developer console | |
// 3. Run the following code | |
{const e=$x('//table[@id="resultatlisteForm:HeleResultater:resultaterPanel"]/tbody/tr[@class="none" or @class="resultatTop"]/td[contains(@class, "col6Resultat") or contains(@class, "col7Studiepoeng")]//span[last()]/text()').reduce((e,t,s,a)=>(s%3==0&&1===a[s+1].length&&e.push({grade:a[s+1].data,credits:parseFloat(a[s+2].data.replace(",","."))}),e),[]),t=e.reduce((e,t)=>e+t.credits,0),s=e.reduce((e,t)=>e+(70-t.grade.charCodeAt(0))*t.credits,0)/t;console.log(`GPA: ${s}, sum of credits: ${t}`)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment