From 3063cfaea1e94b620a0f69fd950b2f6310e18454 Mon Sep 17 00:00:00 2001 From: KaustubhKumar05 Date: Mon, 18 Mar 2024 12:10:21 +0530 Subject: [PATCH] fix: simplify expression --- packages/hms-video-store/src/common/PluginUsageTracker.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/hms-video-store/src/common/PluginUsageTracker.ts b/packages/hms-video-store/src/common/PluginUsageTracker.ts index bcaaf49cac..a23d35b4f1 100644 --- a/packages/hms-video-store/src/common/PluginUsageTracker.ts +++ b/packages/hms-video-store/src/common/PluginUsageTracker.ts @@ -38,9 +38,8 @@ class PluginUsageTracker { case 'mediaPlugin.toggled.off': case 'mediaPlugin.stats': { if (this.pluginLastAddedAt.has(pluginKey)) { - const duration = event.properties.duration - ? event.properties.duration - : (Date.now() - (this.pluginLastAddedAt.get(pluginKey) || 0)) / 1000; + const duration = + event.properties.duration || (Date.now() - (this.pluginLastAddedAt.get(pluginKey) || 0)) / 1000; this.pluginUsage.set(pluginKey, (this.pluginUsage.get(pluginKey) || 0) + Math.max(duration, 0) * 1000); this.pluginLastAddedAt.delete(pluginKey); }