diff --git a/app/components/user-page/course-progress-list.ts b/app/components/user-page/course-progress-list.ts index 17a6b6eb2..dcc23ef0a 100644 --- a/app/components/user-page/course-progress-list.ts +++ b/app/components/user-page/course-progress-list.ts @@ -13,7 +13,12 @@ type Signature = { export default class CourseProgressListComponent extends Component { get courseParticipationGroups() { - const participationsGroupedByCourse: CourseParticipationModel[][] = Object.values(groupBy(this.args.user.courseParticipations, 'course')); + const participationsGroupedByCourse: CourseParticipationModel[][] = Object.values( + groupBy( + this.args.user.courseParticipations.filter((participation) => !participation.course.releaseStatusIsDeprecated), + 'course', + ), + ); const sortedParticipationsGroupedByCourse = participationsGroupedByCourse.map((group) => group.sort((a, b) => new Date(a.lastSubmissionAt).getTime() - new Date(b.lastSubmissionAt).getTime()), diff --git a/tests/acceptance/view-user-profile-test.js b/tests/acceptance/view-user-profile-test.js index 46eacd3bc..11fb89aae 100644 --- a/tests/acceptance/view-user-profile-test.js +++ b/tests/acceptance/view-user-profile-test.js @@ -195,4 +195,34 @@ module('Acceptance | view-user-profile', function (hooks) { await userPage.visit({ username: user.username }); assert.ok(userPage.profileCustomizationNotice.isVisible); }); + + test('it does not show a challenge if it is deprecated', async function (assert) { + testScenario(this.server); + + let currentUser = this.server.schema.users.first(); + let go = this.server.schema.languages.findBy({ slug: 'go' }); + let docker = this.server.schema.courses.findBy({ slug: 'docker' }); + let grep = this.server.schema.courses.findBy({ slug: 'grep' }); + docker.update({ releaseStatus: 'deprecated' }); + + this.server.create('course-participation', { + course: grep, + language: go, + user: currentUser, + completedStageSlugs: grep.stages.models.sortBy('position').slice(0, 5).mapBy('slug'), + lastSubmissionAt: new Date('2020-10-10'), + }); + + this.server.create('course-participation', { + course: docker, + language: go, + user: currentUser, + completedAt: new Date('2020-01-01'), + }); + + await userPage.visit({ username: 'rohitpaulk' }); + + assert.strictEqual(userPage.courseProgressListItems.length, 1, 'only one course progress list item should be shown'); + assert.strictEqual(userPage.courseProgressListItems[0].name, 'Build your own grep', 'the course progress list item should be for grep'); + }); });