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 }) => {