Skip to content

Commit

Permalink
fix: better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qamarq committed Dec 9, 2024
1 parent fac586d commit 428a039
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,19 @@ export function CreateNewPlanPage({
})
.sort((a, b) => a.name.localeCompare(b.name));

// Aktualizacja list
// List update logic:
// Add unique registrations to the updatedRegistrations array
// r - current registration
// i - current index
// a - array of registrations
updatedRegistrations = [...updatedRegistrations, registration].filter(
(r, i, a) => a.findIndex((t) => t.id === r.id) === i,
);

// Add unique courses to the updatedCourses array
// c - current course
// i - current index
// a - array of courses
updatedCourses = [...updatedCourses, ...extendedCourses].filter(
(c, i, a) => a.findIndex((t) => t.id === c.id) === i,
);
Expand Down

0 comments on commit 428a039

Please sign in to comment.