From e2566ea70322f6d8659e488cb387e91e30889940 Mon Sep 17 00:00:00 2001 From: DenitsaTH Date: Mon, 10 Jun 2024 12:57:27 +0300 Subject: [PATCH] students: add check for view course --- src/app/crud/crud_student.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/crud/crud_student.py b/src/app/crud/crud_student.py index 4e3e79c..188b050 100644 --- a/src/app/crud/crud_student.py +++ b/src/app/crud/crud_student.py @@ -148,10 +148,11 @@ async def update_add_student_rating(db: Session, student: Student, course_id: in async def get_course_information(db: Session, course_id: int, student: Student) -> StudentCourseSchema: course: Course = await crud_course.get_course_common_info(db=db, course_id=course_id) - student_rating = await get_student_rating(db=db, student_id=student.student_id, course_id=course_id) - student_progress = await get_student_progress(db=db, student_id=student.student_id, course_id=course_id) if course: + student_rating = await get_student_rating(db=db, student_id=student.student_id, course_id=course_id) + student_progress = await get_student_progress(db=db, student_id=student.student_id, course_id=course_id) + return StudentCourseSchema( course_id=course.course_id, title=course.title,