fix: lesson progress issue
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
</template>
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Button v-if="canSeeStats()" @click="showVideoStats()">
|
||||
<Button v-if="isAdmin" @click="showVideoStats()">
|
||||
<template #icon>
|
||||
<TrendingUp class="size-4 stroke-1.5" />
|
||||
</template>
|
||||
@@ -326,7 +326,7 @@
|
||||
@updateNotes="updateNotes"
|
||||
/>
|
||||
<VideoStatistics
|
||||
v-if="showStatsDialog"
|
||||
v-if="isAdmin"
|
||||
v-model="showStatsDialog"
|
||||
:lessonName="lesson.data?.name"
|
||||
:lessonTitle="lesson.data?.title"
|
||||
@@ -524,7 +524,14 @@ const renderEditor = (holder, content) => {
|
||||
|
||||
const markProgress = () => {
|
||||
if (user.data && lesson.data && !lesson.data.progress) {
|
||||
progress.submit()
|
||||
progress.submit(
|
||||
{},
|
||||
{
|
||||
onError(err) {
|
||||
console.error(err)
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,7 +612,6 @@ watch(
|
||||
plyrSources.value = []
|
||||
await nextTick()
|
||||
resetLessonState(newChapterNumber, newLessonNumber)
|
||||
startTimer()
|
||||
updateNotes()
|
||||
checkIfDiscussionsAllowed()
|
||||
checkQuiz()
|
||||
@@ -674,6 +680,7 @@ watch(
|
||||
() => lesson.data,
|
||||
async (data) => {
|
||||
setupLesson(data)
|
||||
startTimer()
|
||||
getPlyrSource()
|
||||
updateNotes()
|
||||
if (data.icon == 'icon-youtube') clearInterval(timerInterval)
|
||||
@@ -769,17 +776,19 @@ const checkIfDiscussionsAllowed = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const isAdmin = computed(() => {
|
||||
let isInstructor = lesson.data?.instructors?.includes(user.data?.name)
|
||||
return user.data?.is_moderator || isInstructor
|
||||
})
|
||||
|
||||
const allowEdit = () => {
|
||||
if (window.read_only_mode) return false
|
||||
if (user.data?.is_moderator) return true
|
||||
if (lesson.data?.instructors?.includes(user.data?.name)) return true
|
||||
return false
|
||||
return isAdmin.value
|
||||
}
|
||||
|
||||
const allowInstructorContent = () => {
|
||||
if (user.data?.is_moderator) return true
|
||||
if (lesson.data?.instructors?.includes(user.data?.name)) return true
|
||||
return false
|
||||
if (window.read_only_mode) return false
|
||||
return isAdmin.value
|
||||
}
|
||||
|
||||
const enrollment = createResource({
|
||||
@@ -819,11 +828,6 @@ const toggleInlineMenu = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const canSeeStats = () => {
|
||||
if (user.data?.is_moderator || user.data?.is_instructor) return true
|
||||
return false
|
||||
}
|
||||
|
||||
const showVideoStats = () => {
|
||||
showStatsDialog.value = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user