From f36b4d4883c28a783ebdb62da3c8911559583349 Mon Sep 17 00:00:00 2001 From: harshbaz Date: Tue, 28 Nov 2023 10:43:52 +0530 Subject: [PATCH] Fix view count calc --- .../src/components/layout/PlayerLayout.actions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/experiments/src/components/layout/PlayerLayout.actions.ts b/packages/experiments/src/components/layout/PlayerLayout.actions.ts index 3d338f396..b3343f459 100644 --- a/packages/experiments/src/components/layout/PlayerLayout.actions.ts +++ b/packages/experiments/src/components/layout/PlayerLayout.actions.ts @@ -97,11 +97,11 @@ export async function viewPost( const { totalCount, partialWatchedPercentage } = watchProgress if (totalCount === 0 && partialWatchedPercentage === 0) return - updatePostInWatchHistory('up-down-watch-history', post) + const viewCount = (totalCount || 0) + (partialWatchedPercentage || 0) / 100 - const watchCount = (totalCount || 0) + (partialWatchedPercentage || 0) + if (!viewCount) return - if (!watchCount) return + updatePostInWatchHistory('up-down-watch-history', post) await viewVideo( { @@ -110,7 +110,7 @@ export async function viewPost( videoUoid: post.ouid, videoUid: post.video_uid, }, - watchCount, + viewCount, ) const authStateData = get(authState)