aopell/SchoologyPlus

Inefficient Get method for assignment `max_points`

Closed this issue · 2 comments

Going to be adding on to this extension through the semester, so was just browsing through the code.

You make a API call to users/${getUserId()}/grades?section_id=${courseId}, then use a complicated filter system to retrieve the assignment max_points.

let json = await fetchApiJson(`users/${getUserId()}/grades?section_id=${courseId}`);

But there is an assignment API!
image

instead, do something like

const targetAssignment = Number.parseInt(assignment.dataset.id.substr(2));
const json= await fetchApiJson(`sections/${courseID}/assignments/${targetAssignment}`); 
const max_points = json.max_points || 0;

Hello, and thanks so much for your contribution! We are aware of the assignment API, but it actually doesn't have information for all assignments. Certain assignments from what Schoology calls "external tools" (like app integrations etc.) don't show up in the assignments API. Therefore we have to use section grades.

Also, please join our discord if you're able so we can help you out with navigating out codebase, and once again thanks for your support!

Oops - looked through it again and was about to close it but you already got to it - sorry bout that.