From ab273fdcee2689b279427550178c970a39dea57f Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 19 Sep 2024 20:07:19 +1000 Subject: [PATCH] infer years forward for term planner for years we don't have data for yet (#1196) * infer years forward * work for degree after LIVE_YEAR Co-authored-by: olli <80164276+ollibowers@users.noreply.github.com> --------- Co-authored-by: olli <80164276+ollibowers@users.noreply.github.com> --- frontend/src/pages/TermPlanner/TermPlanner.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/TermPlanner/TermPlanner.tsx b/frontend/src/pages/TermPlanner/TermPlanner.tsx index 2cb3e08f1..35c5c3e5e 100644 --- a/frontend/src/pages/TermPlanner/TermPlanner.tsx +++ b/frontend/src/pages/TermPlanner/TermPlanner.tsx @@ -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; @@ -374,7 +378,12 @@ const TermPlanner = () => { [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} />