Обновлены компоненты для учета только прошедших лекций в статистике посещаемости. Добавлено мобильное отображение в компонентах LessonItems и Item, улучшена логика фильтрации лекций. Реализовано отображение QR-кода с учетом темы оформления.
This commit is contained in:
@@ -126,9 +126,21 @@ export const CourseCard = ({ course }: { course: Course }) => {
|
||||
}
|
||||
|
||||
const studentsMap = new Map()
|
||||
const now = dayjs()
|
||||
|
||||
// Собираем данные о всех студентах
|
||||
lessonList.forEach(lesson => {
|
||||
// Фильтруем только прошедшие лекции
|
||||
const pastLessons = lessonList.filter(lesson => dayjs(lesson.date).isBefore(now))
|
||||
|
||||
// Если прошедших лекций нет, возвращаем пустую статистику
|
||||
if (pastLessons.length === 0) {
|
||||
return {
|
||||
topStudents: [],
|
||||
lowAttendanceStudents: []
|
||||
}
|
||||
}
|
||||
|
||||
// Собираем данные о всех студентах (только для прошедших лекций)
|
||||
pastLessons.forEach(lesson => {
|
||||
lesson.students?.forEach(student => {
|
||||
const studentId = student.sub
|
||||
const current = studentsMap.get(studentId) || {
|
||||
@@ -147,9 +159,9 @@ export const CourseCard = ({ course }: { course: Course }) => {
|
||||
})
|
||||
})
|
||||
|
||||
// Для каждого студента установить общее количество лекций
|
||||
// Для каждого студента установить общее количество лекций (только прошедших)
|
||||
studentsMap.forEach(student => {
|
||||
student.total = lessonList.length
|
||||
student.total = pastLessons.length
|
||||
student.percent = (student.attended / student.total) * 100
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user