Skip to content

Commit

Permalink
fix: filter units with no students
Browse files Browse the repository at this point in the history
  • Loading branch information
dh-giang-vu committed Oct 9, 2024
1 parent 2b5453e commit ccdd631
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/scripts/handleInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ export async function prefillUnitSpreadsheet(enrolmentExcel: File) {

const units = unitsMaps.map(m => {
const unitsData = Array.from(m.values());
const transformed = unitsData.map(ud => { return { ...ud, enrolment: JSON.stringify(ud.enrolment) } });
const transformed = unitsData
.filter((ud) => ud.enrolment.length > 0)
.map(ud => { return { ...ud, enrolment: JSON.stringify(ud.enrolment) } });
return transformed;
}).flat();

Expand Down

0 comments on commit ccdd631

Please sign in to comment.