Skip to content

Commit

Permalink
Merge pull request #7413 from stopfstedt/user-profile-cohorts-manager
Browse files Browse the repository at this point in the history
corrects UI glitch with cohort selection in user profile management
  • Loading branch information
jrjohnson authored Sep 16, 2023
2 parents eb5742d + 5a1c085 commit d4dcaa5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 16 additions & 4 deletions app/components/user-profile-cohorts-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,33 @@ export default class UserProfileCohortsManagerComponent extends Component {
@cached
get selectableCohortsData() {
if (this.selectedSchool) {
return new TrackedAsyncData(this.getSelectableCohortsBySchool(this.selectedSchool));
return new TrackedAsyncData(
this.getSelectableCohortsBySchool(
this.selectedSchool,
this.args.primaryCohort,
this.args.secondaryCohorts,
),
);
} else if (this.userSchool) {
return new TrackedAsyncData(this.getSelectableCohortsBySchool(this.userSchool));
return new TrackedAsyncData(
this.getSelectableCohortsBySchool(
this.userSchool,
this.args.primaryCohort,
this.args.secondaryCohorts,
),
);
} else {
return new TrackedAsyncData([]);
}
}

async getSelectableCohortsBySchool(school) {
async getSelectableCohortsBySchool(school, selectedPrimaryCohort, selectedSecondaryCohorts) {
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);
return selectedPrimaryCohort !== cohort && !selectedSecondaryCohorts.includes(cohort);
});
}

Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/curriculum-inventory/rollover-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ module('Acceptance | curriculum inventory report/rollover', function (hooks) {
this.server.post(
`/api/curriculuminventoryreports/:id/rollover`,
function (schema, { params, requestBody }) {
console.log(params);
assert.ok('id' in params);
assert.strictEqual(params.id, reportModel.id);
const data = queryString.parse(requestBody);
Expand Down

0 comments on commit d4dcaa5

Please sign in to comment.