From 22a2e576429b90f707261ecb5e1984e30b6b8c52 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 30 Jun 2025 20:00:13 +0530 Subject: [PATCH] fix: fetch stats when lesson is loaded --- frontend/src/components/Modals/VideoStatistics.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Modals/VideoStatistics.vue b/frontend/src/components/Modals/VideoStatistics.vue index 12c58625..4bbd4d43 100644 --- a/frontend/src/components/Modals/VideoStatistics.vue +++ b/frontend/src/components/Modals/VideoStatistics.vue @@ -77,7 +77,7 @@ import { NumberChart, TabButtons, } from 'frappe-ui' -import { computed, ref } from 'vue' +import { computed, ref, watch } from 'vue' import VideoBlock from '@/components/VideoBlock.vue' const show = defineModel() @@ -102,13 +102,22 @@ const statistics = createListResource({ 'source', 'watch_time', ], - auto: true, cache: ['videoStatistics', props.lessonName], onSuccess() { currentTab.value = Object.keys(statisticsData.value)[0] }, }) +watch( + () => props.lessonName, + () => { + if (props.lessonName) { + statistics.filters.lesson = props.lessonName + statistics.reload() + } + } +) + const statisticsData = computed(() => { const grouped = >{} statistics.data.forEach((item: { source: string }) => {