Closed Lathryx closed 3 years ago
Everything looks great! However, I notice a bug in lines 308-311. If any of the
.progress
properties are nullish (i.e. 0) it will trigger the "no grades" if statement and set .grades to undefined. Another reason why nullish coalescing is great. I'll make a PR real quick and fix it.// the following works 5 || undefined == 5 // !!5 == true, picks the left expression undefined || 5 == 5 // !!undefined == false, picks the right expression // here is the error, the || operator casts the values to booleans, and 0 is a falsy value. 0 || undefined == undefined // !!0 == false, picks the right expression
- @qwazwsx
Hmm, I could've sworn I fixed this with this change:
// from this:
// if (!grade.progressScore
// && !grade.progressPercent
// && !grade.progressTotalPoints
// && !grade.progressPointsEarned)
// courseResult.grades = undefined
// to this:
if (!(grade.progressScore || grade.score)
&& !(grade.progressPercent || grade.percent)
&& !(grade.progressTotalPoints || grade.totalPoints)
&& !(grade.progressPointsEarned || grade.pointsEarned))
courseResult.grades = undefined;
This (^) is what you were talking about, correct?
the documentation still needs updating to reflect the multiple schools change to User.getCourses
I also still need to push V3.1.0 to NPM
Got it. I can help with the docs if you want. I'm eagerly waiting for the NPM update (currently working on my project's back-end, where I'll be using this API)!
Also, send me a friend request on Discord (Lathryx#2826) when you get a chance! :)
Firstly,
grades
are returned by the IC API using multiple different names, so now this library accounts for that.Secondly, the function in order to account for courses without grades was changed slightly to work with both variables as well.
Thirdly, this update adds some slight restructuring to ensure users with multiple schools can still use the API (and the
comments
property was added to the returned data as well).