diff --git a/apps/server/src/models/lecture/utils.ts b/apps/server/src/models/lecture/utils.ts index 008bc87..f5216f8 100644 --- a/apps/server/src/models/lecture/utils.ts +++ b/apps/server/src/models/lecture/utils.ts @@ -1,39 +1,39 @@ -import { db, Lecture } from "@nice/common" +import { db, Lecture } from '@nice/common'; export async function updateSectionLectureStats(sectionId: string) { - const sectionStats = await db.lecture.aggregate({ - where: { - sectionId, - deletedAt: null - }, - _count: { _all: true }, - _sum: { duration: true } - }); + const sectionStats = await db.lecture.aggregate({ + where: { + sectionId, + deletedAt: null, + }, + _count: { _all: true }, + _sum: { duration: true }, + }); - await db.section.update({ - where: { id: sectionId }, - data: { - totalLectures: sectionStats._count._all, - totalDuration: sectionStats._sum.duration || 0 - } - }); + await db.section.update({ + where: { id: sectionId }, + data: { + // totalLectures: sectionStats._count._all, + // totalDuration: sectionStats._sum.duration || 0, + }, + }); } export async function updateCourseLectureStats(courseId: string) { - const courseStats = await db.lecture.aggregate({ - where: { - courseId, - deletedAt: null - }, - _count: { _all: true }, - _sum: { duration: true } - }); + const courseStats = await db.lecture.aggregate({ + where: { + courseId, + deletedAt: null, + }, + _count: { _all: true }, + _sum: { duration: true }, + }); - await db.course.update({ - where: { id: courseId }, - data: { - totalLectures: courseStats._count._all, - totalDuration: courseStats._sum.duration || 0 - } - }); -} \ No newline at end of file + await db.course.update({ + where: { id: courseId }, + data: { + //totalLectures: courseStats._count._all, + //totalDuration: courseStats._sum.duration || 0, + }, + }); +}