Skip to content

Commit

Permalink
Fix archived skill challenges list view
Browse files Browse the repository at this point in the history
Co-authored-by: Iris Benoit-Martin <[email protected]>
Co-authored-by: Jérémie Jadé <[email protected]>
  • Loading branch information
3 people committed Oct 2, 2024
1 parent 81c88b1 commit 91fd4c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,28 @@ export default class CompetenceSkillsSingleArchiveController extends Controller
}

get challengeList() {
return this.skill.challenges.toArray().sort((a, b) => {
if (a.version > b.version) {
return 1;
} else if (a.version < b.version) {
return -1;
} else if (a.isPrototype) {
return -1;
} else if (b.isPrototype) {
return 1;
}
return 0;
});
return this.skill.challengesArray
.slice()
.sort((a, b) => {
if (a.version > b.version) {
return 1;
} else if (a.version < b.version) {
return -1;
} else if (a.isPrototype) {
return -1;
} else if (b.isPrototype) {
return 1;
}
return 0;
});
}

get alternativesCount() {
return this.skill.challenges.filter((challenge) => !challenge.isPrototype).length;
return this.skill.challengesArray.filter((challenge) => !challenge.isPrototype).length;
}

get prototypesCount() {
return this.skill.challenges.filter((challenge) => challenge.isPrototype).length;
return this.skill.prototypes.length;
}

maximizeRight(value) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Route from '@ember/routing/route';

export default class CompetenceSkillsSingleArchiveRoute extends Route {}
export default class CompetenceSkillsSingleArchiveRoute extends Route {
async afterModel(skill) {
await skill.challenges;
}
}

0 comments on commit 91fd4c7

Please sign in to comment.