Skip to content

Commit

Permalink
infer years forward for term planner for years we don't have data for…
Browse files Browse the repository at this point in the history
… yet (#1196)

* infer years forward

* work for degree after LIVE_YEAR

Co-authored-by: olli <[email protected]>

---------

Co-authored-by: olli <[email protected]>
  • Loading branch information
martanman and ollibowers authored Sep 19, 2024
1 parent 72801cf commit ab273fd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 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,12 @@ const TermPlanner = () => {
<UnplannedColumn
dragging={!!draggingCourse}
courseInfos={Object.fromEntries(
planner.unplanned.map((code) => [code, courseInfos[LIVE_YEAR][code]])
planner.unplanned.map((code) => [
code,
courseInfos[validYears.includes(LIVE_YEAR) ? LIVE_YEAR : validYears.at(-1)!][
code
]
])
)}
validateInfos={validations.courses_state}
/>
Expand Down

0 comments on commit ab273fd

Please sign in to comment.