Skip to content

Commit

Permalink
Update by review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Oct 25, 2024
1 parent 69d3b83 commit 49ab8f5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,8 @@ def check_frequency(self, challenge_id):
too_frequent = False
latest = None
if matched_feedbacks:
latest = matched_feedbacks.first().submit_datetime
for feedback in matched_feedbacks:
if feedback.submit_datetime > latest:
latest = feedback.submit_datetime
latest_feedback = matched_feedbacks.latest('submit_datetime')
latest = latest_feedback.submit_datetime

current = timezone.now()
if current - latest <= timedelta(hours=1):
Expand All @@ -267,7 +265,8 @@ def check_frequency(self, challenge_id):
def get(self, request, challenge_id):
# check if this is set, even as None
# to make admins quickly notice if they forgot this...
settings.FEEDBACK_ENDPOINT and settings.FEEDBACK_KEY
if settings.FEEDBACK_ENDPOINT:
assert settings.FEEDBACK_KEY
challenge = self.check(challenge_id)
if not challenge:
messages.error(request, "反馈功能不可用。")
Expand Down

0 comments on commit 49ab8f5

Please sign in to comment.