Skip to content

Commit 0c42d7d

Browse files
committed
Replace the query to find a user's latest comment
1 parent d74318b commit 0c42d7d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

judge/comments.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def post(self, request, *args, **kwargs):
7575
return HttpResponseForbidden()
7676

7777
if not request.user.is_superuser:
78-
user_latest_comments = Comment.get_newest_visible_comments(viewer=request.user,
79-
author=request.user.profile,
80-
n=1)
78+
user_latest_comments = Comment.objects.filter(author=request.profile).order_by('-time')[:1]
8179

8280
if len(user_latest_comments) > 0:
8381
time_diff = (datetime.now(timezone.utc) - user_latest_comments[0].time).seconds

0 commit comments

Comments
 (0)