GradeVuer Dev Log

Programming knowledge may be required!

Grade calculation

For this basic example, we will limit grade calculation to All Tasks and Practice Prep being the only categories.

To calculate a grade, where

aeia_{ei}, peip_{ei} is the points earned on the ith all task and practice prep assignment and apia_{pi}, ppip_{pi} is the points possible on the ith all task and practice prep assignment. The formula would just be: 0.9aeiapi+0.1peippi0.9\frac{\sum_{}^{}a_{ei}}{\sum_{}^{}a_{pi}}+0.1\frac{\sum_{}^{}p_{ei}}{\sum_{}^{}p_{pi}} In JavaScript, the following code would calculate the total grade
function calculateGrade() {
    let assignments = [
        { points_earned: 20, points_possible: 25, all_tasks: true },
        { points_earned: 25, points_possible: 25, all_tasks: true },
        { points_earned: 12, points_possible: 20, all_tasks: false }
    ];

    let ate = 0;
    let atp = 0;
    let pte = 0;
    let ptp = 0;

    for (let i = 0; i < assignments.length; i++) {
        if (assignments[i].all_tasks) {
            ate += assignments[i].points_earned; 
            atp += assignments[i].points_possible;
        } else {
            pte += assignments[i].points_earned;
            ptp += assignments[i].points_possible;
        }
    }

    return (ate / atp) * 0.9 + (pte / ptp) * 0.1;
}

Fetching grade data

To fetch grade data, GradeVuer relies on the backend API found at https://svue.zillorz.dev/grades. This api expects a GET request with an authorization header of "Basic {base64(username + ":" + password)}"

The backend program emulates a web browser through GET and POST requests to the StudentVue website. This leads to a speed much faster than a traditional web browser which needs to load the bloated StudentVue website.

Finally, after making a successful request, the response will contain a Set-Token response header. This header contains a token which is valid for 24 hours and is much faster than authenticating every time. To use the token, set the authorization header to "Bearer {Token}".

Try it out below!

0 - None

Thanks for reading!