Skip to content

Commit

Permalink
fix(sortGrades): now handle sub-subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
Truiteseche committed Jan 19, 2024
1 parent 8ea147d commit 7ad80e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
})
Expand Down

0 comments on commit 7ad80e4

Please sign in to comment.