From e6166656bb5fc0a6c94e5210ee7298c174fb1e36 Mon Sep 17 00:00:00 2001 From: mutugiii Date: Thu, 30 Jul 2020 09:43:50 +0300 Subject: [PATCH] Certifications: Certifications complete WIP --- .../certifications/certifications.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/manager-dashboard/certifications/certifications.service.ts b/src/app/manager-dashboard/certifications/certifications.service.ts index 18d8d48e27..a86b5acefc 100644 --- a/src/app/manager-dashboard/certifications/certifications.service.ts +++ b/src/app/manager-dashboard/certifications/certifications.service.ts @@ -56,10 +56,16 @@ export class CertificationsService { } isCourseCompleted(course, user) { - return course.doc.steps.length === course.progress + const coursesArr = [ ...course.progress ]; + + const callback = (element, index, array) => { + return index + 1 === coursesArr .filter(step => step.userId === user._id && step.passed) .map(step => step.stepNum) .reduce(dedupeShelfReduce, []).length; + }; + + return course.doc.steps.every(callback); } }