Skip to content

Commit

Permalink
crud_teacher: edited get_courses_reports()
Browse files Browse the repository at this point in the history
  • Loading branch information
olesya-karpets committed Jun 9, 2024
1 parent af06dc6 commit 16ee22f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/crud/crud_teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async def get_courses_reports(db: Session, teacher: Teacher, min_progress: float
courses_query = courses_query.order_by(Course.course_id.desc())

result = db.execute(courses_query) #result contains raw SQL rows
courses_with_students = result.scalars().all() # scalars() converts raw SQL rows into ORM objects(Course instances)
courses_with_students = result.scalars().unique().all() # scalars() converts raw SQL rows into ORM objects

student_progress_dict = await calculate_student_progresses(db, courses_with_students)
courses_reports = generate_reports(courses_with_students, student_progress_dict, min_progress)
Expand Down

0 comments on commit 16ee22f

Please sign in to comment.