Skip to content

Commit

Permalink
infer years forward
Browse files Browse the repository at this point in the history
  • Loading branch information
martanman committed Sep 12, 2024
1 parent f243acc commit 1fff7c4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frontend/src/pages/TermPlanner/TermPlanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ const extrapolateCourseYears = (

validYears.forEach((year) => {
if (newData[year]) bestYear = year;
else newData[year] = { ...newData[bestYear], terms: [] };
else
newData[year] = {
...newData[bestYear],
terms: year > LIVE_YEAR ? newData[LIVE_YEAR].terms : []
};
});

return newData;
Expand Down Expand Up @@ -374,7 +378,10 @@ const TermPlanner = () => {
<UnplannedColumn
dragging={!!draggingCourse}
courseInfos={Object.fromEntries(
planner.unplanned.map((code) => [code, courseInfos[LIVE_YEAR][code]])
planner.unplanned.map((code) => [
code,
courseInfos[Math.min(validYears.at(-1)!, LIVE_YEAR)][code]
])
)}
validateInfos={validations.courses_state}
/>
Expand Down

0 comments on commit 1fff7c4

Please sign in to comment.