Skip to content

Commit c11b68e

Browse files
committed
auto join contest
1 parent e1528b2 commit c11b68e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

judge/views/contests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ def get_context_data(self, **kwargs):
207207
virtual=ContestParticipation.LIVE,
208208
)
209209
)
210+
# small fix so that users doesn't need to click the join button
211+
if not self.object.ended and self.request.profile.current_contest != context['live_participation']:
212+
self.request.profile.current_contest = context['live_participation']
213+
self.request.profile.save()
210214
except ContestParticipation.DoesNotExist:
211215
context['live_participation'] = None
212216
context['has_joined'] = False
@@ -276,12 +280,8 @@ class ContestDetail(ContestMixin, TitleMixin, CommentedDetailView):
276280
template_name = 'contest/contest.html'
277281

278282
def is_comment_locked(self):
279-
if self.object.use_clarifications:
280-
now = timezone.now()
281-
if self.is_in_contest or (self.object.start_time <= now and now <= self.object.end_time):
282-
return True
283-
284-
return super(ContestDetail, self).is_comment_locked()
283+
# this trigger the is_in_contest cache -> which make the fix at #210
284+
return True
285285

286286
def get_comment_page(self):
287287
return 'c:%s' % self.object.key

0 commit comments

Comments
 (0)