From e634bfa708199eabf57c9a5305226ef98b91ec20 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sun, 10 Sep 2023 21:32:28 -0700 Subject: [PATCH] Load school cohorts Without calling the deprecated school.cohorts property --- app/components/user-profile-cohorts-manager.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/user-profile-cohorts-manager.js b/app/components/user-profile-cohorts-manager.js index e14fdf26cc..846940db88 100644 --- a/app/components/user-profile-cohorts-manager.js +++ b/app/components/user-profile-cohorts-manager.js @@ -83,8 +83,10 @@ export default class UserProfileCohortsManagerComponent extends Component { } async getSelectableCohortsBySchool(school) { - const cohorts = await school.cohorts; - const sortedCohorts = await sortCohorts(cohorts.slice()); + const programs = await school.programs; + const programYears = (await Promise.all(programs.map((p) => p.programYears))).flat(); + const cohorts = await Promise.all(programYears.map((py) => py.cohort)); + const sortedCohorts = await sortCohorts(cohorts); return sortedCohorts.filter((cohort) => { return this.args.primaryCohort !== cohort && !this.args.secondaryCohorts.includes(cohort); });