diff --git a/examples/grades-overview.ts b/examples/grades-overview.ts index 784dca3..8baf7c7 100644 --- a/examples/grades-overview.ts +++ b/examples/grades-overview.ts @@ -87,4 +87,11 @@ import { authenticatePronoteCredentials, PronoteApiAccountId, PronoteApiGradeTyp }); console.groupEnd(); + + console.group("--- GLOBAL AVERAGE ---\n"); + + console.log("Student:", gradesOverview.overallAverage); + console.log("Class:", gradesOverview.classAverage); + + console.groupEnd(); })(); diff --git a/src/client/Pronote.ts b/src/client/Pronote.ts index ab6976c..29bcb8f 100644 --- a/src/client/Pronote.ts +++ b/src/client/Pronote.ts @@ -21,6 +21,7 @@ import { getUTCDate, setDayToEnd, setDayToStart } from "~/utils/dates"; import { callApiUserGrades } from "~/api/user/grades"; import { StudentGrade } from "~/parser/grade"; import { StudentAverage } from "~/parser/average"; +import { readPronoteApiGrade } from "~/pronote/grades"; export default class Pronote { /** @@ -196,6 +197,7 @@ export default class Pronote { /** * Get grades overview for a specific period. + * Including student's grades with averages and the global averages. * * @remark Internally used in the `Period` class. * @param period - Period the grades overview will be from. @@ -211,7 +213,10 @@ export default class Pronote { grades: data.listeDevoirs.V .map((grade) => new StudentGrade(this, period, grade)), averages: data.listeServices.V - .map((average) => new StudentAverage(average)) + .map((average) => new StudentAverage(average)), + + overallAverage: readPronoteApiGrade(data.moyGenerale.V), + classAverage: readPronoteApiGrade(data.moyGeneraleClasse.V) }; } }