From af668f14bcab0d75399b1d8d749878bdf953c0d3 Mon Sep 17 00:00:00 2001 From: Anubhav Jain Date: Tue, 5 Mar 2024 18:57:36 +0530 Subject: [PATCH 1/2] fixed-the-percentage-count-issue-in-course-card-component By applying a check for hidden files , i have resolved this issue --- src/utiles/appx.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utiles/appx.ts b/src/utiles/appx.ts index 5a7deed50..ab169188a 100644 --- a/src/utiles/appx.ts +++ b/src/utiles/appx.ts @@ -31,8 +31,8 @@ export async function getPurchases(email: string) { let totalVideos = 0; let totalVideosWatched = 0; course.content.forEach(({ contentId }) => { - allVideos.forEach(({ parentId, id }) => { - if (parentId === contentId) { + allVideos.forEach(({ parentId, id, hidden }) => { + if (parentId === contentId && !hidden) { totalVideos++; if (completedVideosLookup[id]) { totalVideosWatched++; From 6d98b92d014f826220c525212dd1d8ccc93b5fcf Mon Sep 17 00:00:00 2001 From: Anubhav Jain Date: Thu, 7 Mar 2024 07:34:51 +0530 Subject: [PATCH 2/2] -changing-db-query-for-videos-not-hidden-and-reverting-logic --- src/db/course.ts | 1 + src/utiles/appx.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db/course.ts b/src/db/course.ts index ab101461b..7b5c682e6 100644 --- a/src/db/course.ts +++ b/src/db/course.ts @@ -108,6 +108,7 @@ export async function getAllVideos(): Promise< const courses = await db.content.findMany({ where: { type: 'video', + hidden: false, }, }); Cache.getInstance().set('getAllVideos', [], courses); diff --git a/src/utiles/appx.ts b/src/utiles/appx.ts index ab169188a..5a7deed50 100644 --- a/src/utiles/appx.ts +++ b/src/utiles/appx.ts @@ -31,8 +31,8 @@ export async function getPurchases(email: string) { let totalVideos = 0; let totalVideosWatched = 0; course.content.forEach(({ contentId }) => { - allVideos.forEach(({ parentId, id, hidden }) => { - if (parentId === contentId && !hidden) { + allVideos.forEach(({ parentId, id }) => { + if (parentId === contentId) { totalVideos++; if (completedVideosLookup[id]) { totalVideosWatched++;