Skip to content

Commit 42ed81e

Browse files
authored
Update lecturer.py
1 parent 635e7a4 commit 42ed81e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rating_api/routes/lecturer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def get_lecturer(id: int, info: list[Literal["comments", "mark"]] = Query(
5959
if comment.review_status is ReviewStatus.APPROVED
6060
]
6161
if "comments" in info and approved_comments:
62-
result.comments = approved_comments
62+
result.comments = sorted(approved_comments, key=lambda comment: comment.create_ts, reverse=True)
6363
if "mark" in info and approved_comments:
6464
result.mark_freebie = sum(comment.mark_freebie for comment in approved_comments) / len(approved_comments)
6565
result.mark_kindness = sum(comment.mark_kindness for comment in approved_comments) / len(approved_comments)

0 commit comments

Comments
 (0)