feat: перелопатил синхронизацию преподавателей
Backend CI / build-and-test (push) Failing after 13m11s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m12s
Frontend CI / build-and-check (push) Failing after 16m9s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m6s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m58s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m58s

This commit is contained in:
2026-05-24 21:06:03 +03:00
parent 6aef5dd66f
commit 99d25adbb1
33 changed files with 1756 additions and 90 deletions
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import { computed, onMounted, watch } from 'vue'
import { useRouter } from 'vue-router'
import { useLecturesStore } from '@/stores/lectures'
import { useAuthStore } from '@/stores/auth'
@@ -13,16 +13,19 @@ const auth = useAuthStore()
const router = useRouter()
const teacherLectures = computed(() => {
const owned = lecturesStore.all.filter(l => auth.user && l.teacher.includes(auth.user.name))
return owned.length ? owned : lecturesStore.all
return lecturesStore.all
})
const upcoming = computed(() => teacherLectures.value.filter(l => l.status !== 'completed').slice(0, 3))
const enrolledTotal = computed(() => teacherLectures.value.reduce((sum, l) => sum + l.enrolledSeats, 0))
const visibility = computed(() => (teacherLectures.value.length ? Math.min(100, Math.round(enrolledTotal.value * 4)) : 0))
onMounted(() => {
if (!lecturesStore.all.length) void lecturesStore.fetchLectures()
})
function fetchTeacherLectures() {
if (!auth.user?.id) return
void lecturesStore.fetchLectures({ TeacherId: auth.user.id })
}
onMounted(fetchTeacherLectures)
watch(() => auth.user?.id, fetchTeacherLectures)
</script>
<template>