From 7ad80e46e184e64184b39a38825a8e42a2ef73a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Truite=20S=C3=A9ch=C3=A9e?= Date: Fri, 19 Jan 2024 19:15:00 +0100 Subject: [PATCH] fix(sortGrades): now handle sub-subjects --- src/App.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 3c3c401c..2f9791b8 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -657,6 +657,9 @@ export default function App() { newPeriod.subjects = {}; let i = 0; for (let matiere of period.ensembleMatieres.disciplines) { + if (matiere.sousMatiere) { + continue; + } let subjectCode = matiere.codeMatiere; if (matiere.groupeMatiere) { subjectCode = "category" + i.toString(); @@ -703,7 +706,7 @@ export default function App() { const gradesFromJson = grades[activeAccount].notes; const subjectDatas = {}; - for (let grade of gradesFromJson) { + for (let grade of (gradesFromJson ?? [])) { const periodCode = grade.codePeriode; const subjectCode = grade.codeMatiere; // try to rebuild the subject if it doesn't exist (happen when changing school year) @@ -1207,7 +1210,7 @@ export default function App() { setGrades(usersGrades); } else if (code === 49969) { let usersGrades = [...grades]; - import("./data/grades.json").then((module) => { + import("./data/test_grades.json").then((module) => { usersGrades[userId] = module.data; setGrades(usersGrades); })