From 99c1d9af689e5325f3cf535c4007b3aeb8325229 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 10 Jan 2023 14:54:04 +0100 Subject: Update - This is an automated commit --- .../pronote-api/src/fetch/pronote/evaluations.js | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 school/node_modules/pronote-api/src/fetch/pronote/evaluations.js (limited to 'school/node_modules/pronote-api/src/fetch/pronote/evaluations.js') diff --git a/school/node_modules/pronote-api/src/fetch/pronote/evaluations.js b/school/node_modules/pronote-api/src/fetch/pronote/evaluations.js new file mode 100644 index 0000000..c9065fd --- /dev/null +++ b/school/node_modules/pronote-api/src/fetch/pronote/evaluations.js @@ -0,0 +1,49 @@ +const parse = require('../../data/types'); +const { toPronote } = require('../../data/objects'); + +const navigate = require('./navigate'); + +const PAGE_NAME = 'DernieresEvaluations'; +const TAB_ID = 201; +const ACCOUNTS = ['student', 'parent']; + +async function getEvaluations(session, user, period) +{ + const evaluations = await navigate(session, user, PAGE_NAME, TAB_ID, ACCOUNTS, { + periode: period.name ? toPronote(period) : period + }); + + if (!evaluations) { + return null; + } + + return parse(evaluations.listeEvaluations, ({ + listeNiveauxDAcquisitions, listePaliers, matiere, individu, coefficient, descriptif, date, periode + }) => ({ + title: descriptif, + acquisitionLevels: parse(listeNiveauxDAcquisitions, ({ + abbreviation, ordre, pilier, coefficient, domaine, item + }) => ({ + position: ordre, + value: abbreviation, + pillar: parse(pilier, ({ strPrefixes }) => ({ + prefixes: strPrefixes.split(', ') + })), + coefficient, + domain: parse(domaine), + item: item && parse(item) || null + })), + levels: parse(listePaliers), + subject: parse(matiere, ({ couleur, ordre, serviceConcerne }) => ({ + position: ordre, + service: parse(serviceConcerne), + color: couleur + })), + teacher: parse(individu), + coefficient, + date: parse(date), + period: parse(periode) + })); +} + +module.exports = getEvaluations; -- cgit