Joining contest also leaves current contest

This commit is contained in:
cuom1999 2024-04-24 22:33:57 -05:00
parent 345684300f
commit 86d1ff4eaa
6 changed files with 151 additions and 137 deletions

View file

@ -186,21 +186,17 @@ class PostView(TitleMixin, CommentedDetailView, PageVoteDetailView, BookMarkDeta
context["og_image"] = self.object.og_image context["og_image"] = self.object.og_image
context["editable_orgs"] = [] context["editable_orgs"] = []
can_edit = False
orgs = list(self.object.organizations.all()) orgs = list(self.object.organizations.all())
if self.request.profile: if self.request.profile:
if self.request.profile.id in self.object.get_authors(): if self.request.profile.id in self.object.get_authors():
can_edit = True for org in orgs:
if org.is_member(self.request.profile):
for org in orgs: context["editable_orgs"].append(org)
if org.is_admin(self.request.profile): else:
can_edit = True for org in orgs:
if org.is_admin(self.request.profile):
if can_edit: context["editable_orgs"].append(org)
for org in orgs:
if org.is_member(self.request.profile):
context["editable_orgs"].append(org)
return context return context

View file

@ -468,6 +468,10 @@ class ContestDetail(
) )
context["editable_organizations"] = self.get_editable_organizations() context["editable_organizations"] = self.get_editable_organizations()
context["is_clonable"] = is_contest_clonable(self.request, self.object) context["is_clonable"] = is_contest_clonable(self.request, self.object)
if self.request.in_contest:
context["current_contest"] = self.request.participation.contest
else:
context["current_contest"] = None
return context return context
@ -587,12 +591,7 @@ class ContestJoin(LoginRequiredMixin, ContestMixin, BaseDetailView):
profile = request.profile profile = request.profile
if profile.current_contest is not None: if profile.current_contest is not None:
return generic_message( profile.remove_contest()
request,
_("Already in contest"),
_('You are already in a contest: "%s".')
% profile.current_contest.contest.name,
)
if ( if (
not request.user.is_superuser not request.user.is_superuser
@ -671,6 +670,7 @@ class ContestJoin(LoginRequiredMixin, ContestMixin, BaseDetailView):
profile.save() profile.save()
contest._updating_stats_only = True contest._updating_stats_only = True
contest.update_user_count() contest.update_user_count()
request.session["contest_mode"] = True
return HttpResponseRedirect(reverse("problem_list")) return HttpResponseRedirect(reverse("problem_list"))
def ask_for_access_code(self, form=None): def ask_for_access_code(self, form=None):

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: lqdoj2\n" "Project-Id-Version: lqdoj2\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-23 14:12+0700\n" "POT-Creation-Date: 2024-04-25 10:33+0700\n"
"PO-Revision-Date: 2021-07-20 03:44\n" "PO-Revision-Date: 2021-07-20 03:44\n"
"Last-Translator: Icyene\n" "Last-Translator: Icyene\n"
"Language-Team: Vietnamese\n" "Language-Team: Vietnamese\n"
@ -118,7 +118,7 @@ msgid "Included contests"
msgstr "" msgstr ""
#: judge/admin/contest.py:80 judge/admin/volunteer.py:54 #: judge/admin/contest.py:80 judge/admin/volunteer.py:54
#: templates/contest/clarification.html:42 templates/contest/contest.html:120 #: templates/contest/clarification.html:42 templates/contest/contest.html:116
#: templates/contest/moss.html:41 templates/internal/left-sidebar.html:2 #: templates/contest/moss.html:41 templates/internal/left-sidebar.html:2
#: templates/internal/problem/problem.html:41 templates/problem/list.html:17 #: templates/internal/problem/problem.html:41 templates/problem/list.html:17
#: templates/problem/list.html:34 templates/problem/list.html:153 #: templates/problem/list.html:34 templates/problem/list.html:153
@ -138,9 +138,9 @@ msgstr ""
msgid "Details" msgid "Details"
msgstr "Chi tiết" msgstr "Chi tiết"
#: judge/admin/contest.py:187 templates/contest/list.html:261 #: judge/admin/contest.py:187 templates/contest/list.html:266
#: templates/contest/list.html:301 templates/contest/list.html:345 #: templates/contest/list.html:306 templates/contest/list.html:350
#: templates/contest/list.html:382 #: templates/contest/list.html:387
msgid "Format" msgid "Format"
msgstr "Thể thức" msgstr "Thể thức"
@ -253,7 +253,7 @@ msgid "Taxonomy"
msgstr "" msgstr ""
#: judge/admin/problem.py:230 judge/admin/problem.py:463 #: judge/admin/problem.py:230 judge/admin/problem.py:463
#: templates/contest/contest.html:121 #: templates/contest/contest.html:117
#: templates/contest/contests_summary.html:41 templates/problem/data.html:536 #: templates/contest/contests_summary.html:41 templates/problem/data.html:536
#: templates/problem/list.html:22 templates/problem/list.html:48 #: templates/problem/list.html:22 templates/problem/list.html:48
#: templates/user/base-users-table.html:10 templates/user/user-about.html:36 #: templates/user/base-users-table.html:10 templates/user/user-about.html:36
@ -426,9 +426,9 @@ msgstr[0] "%d bài nộp đã được tính điểm lại."
msgid "Rescore the selected submissions" msgid "Rescore the selected submissions"
msgstr "Tính điểm lại cái bài nộp" msgstr "Tính điểm lại cái bài nộp"
#: judge/admin/submission.py:332 templates/contest/list.html:246 #: judge/admin/submission.py:332 templates/contest/list.html:251
#: templates/contest/list.html:290 templates/contest/list.html:334 #: templates/contest/list.html:295 templates/contest/list.html:339
#: templates/contest/list.html:376 templates/notification/list.html:12 #: templates/contest/list.html:381 templates/notification/list.html:12
#: templates/organization/requests/log.html:10 #: templates/organization/requests/log.html:10
#: templates/organization/requests/pending.html:20 #: templates/organization/requests/pending.html:20
#: templates/problem/list.html:154 #: templates/problem/list.html:154
@ -2788,141 +2788,132 @@ msgstr "Bạn phải giải ít nhất một bài trước khi được phép b
msgid "Posted comment" msgid "Posted comment"
msgstr "Bình luận đã đăng" msgstr "Bình luận đã đăng"
#: judge/views/contests.py:122 judge/views/contests.py:406 #: judge/views/contests.py:122 judge/views/contests.py:405
#: judge/views/contests.py:411 judge/views/contests.py:708 #: judge/views/contests.py:410 judge/views/contests.py:710
msgid "No such contest" msgid "No such contest"
msgstr "Không có contest nào như vậy" msgstr "Không có contest nào như vậy"
#: judge/views/contests.py:123 judge/views/contests.py:407 #: judge/views/contests.py:123 judge/views/contests.py:406
#, python-format #, python-format
msgid "Could not find a contest with the key \"%s\"." msgid "Could not find a contest with the key \"%s\"."
msgstr "Không tìm thấy kỳ thi với mã \"%s\"." msgstr "Không tìm thấy kỳ thi với mã \"%s\"."
#: judge/views/contests.py:142 judge/views/contests.py:1478 #: judge/views/contests.py:142 judge/views/contests.py:1480
#: judge/views/stats.py:178 templates/contest/list.html:242 #: judge/views/stats.py:178 templates/contest/list.html:247
#: templates/contest/list.html:286 templates/contest/list.html:330 #: templates/contest/list.html:291 templates/contest/list.html:335
#: templates/contest/list.html:372 #: templates/contest/list.html:377
#: templates/organization/org-left-sidebar.html:5 templates/stats/site.html:21 #: templates/organization/org-left-sidebar.html:5 templates/stats/site.html:21
#: templates/user/user-bookmarks.html:56 #: templates/user/user-bookmarks.html:56
msgid "Contests" msgid "Contests"
msgstr "Kỳ thi" msgstr "Kỳ thi"
#: judge/views/contests.py:411 #: judge/views/contests.py:410
msgid "Could not find such contest." msgid "Could not find such contest."
msgstr "Không tìm thấy kỳ thi nào như vậy." msgstr "Không tìm thấy kỳ thi nào như vậy."
#: judge/views/contests.py:419 #: judge/views/contests.py:418
#, python-format #, python-format
msgid "Access to contest \"%s\" denied" msgid "Access to contest \"%s\" denied"
msgstr "Truy cập tới kỳ thi \"%s\" bị từ chối" msgstr "Truy cập tới kỳ thi \"%s\" bị từ chối"
#: judge/views/contests.py:490 #: judge/views/contests.py:496
msgid "Clone Contest" msgid "Clone Contest"
msgstr "Nhân bản kỳ thi" msgstr "Nhân bản kỳ thi"
#: judge/views/contests.py:582 #: judge/views/contests.py:588
msgid "Contest not ongoing" msgid "Contest not ongoing"
msgstr "Kỳ thi đang không diễn ra" msgstr "Kỳ thi đang không diễn ra"
#: judge/views/contests.py:583 #: judge/views/contests.py:589
#, python-format #, python-format
msgid "\"%s\" is not currently ongoing." msgid "\"%s\" is not currently ongoing."
msgstr "\"%s\" kỳ thi đang không diễn ra." msgstr "\"%s\" kỳ thi đang không diễn ra."
#: judge/views/contests.py:590 #: judge/views/contests.py:602
msgid "Already in contest"
msgstr "Đã ở trong kỳ thi"
#: judge/views/contests.py:591
#, python-format
msgid "You are already in a contest: \"%s\"."
msgstr "Bạn đã ở trong kỳ thi: \"%s\"."
#: judge/views/contests.py:601
msgid "Banned from joining" msgid "Banned from joining"
msgstr "Bị cấm tham gia" msgstr "Bị cấm tham gia"
#: judge/views/contests.py:603 #: judge/views/contests.py:604
msgid "" msgid ""
"You have been declared persona non grata for this contest. You are " "You have been declared persona non grata for this contest. You are "
"permanently barred from joining this contest." "permanently barred from joining this contest."
msgstr "Bạn không được phép tham gia kỳ thi này." msgstr "Bạn không được phép tham gia kỳ thi này."
#: judge/views/contests.py:692 #: judge/views/contests.py:694
#, python-format #, python-format
msgid "Enter access code for \"%s\"" msgid "Enter access code for \"%s\""
msgstr "Nhập mật khẩu truy cập cho \"%s\"" msgstr "Nhập mật khẩu truy cập cho \"%s\""
#: judge/views/contests.py:709 #: judge/views/contests.py:711
#, python-format #, python-format
msgid "You are not in contest \"%s\"." msgid "You are not in contest \"%s\"."
msgstr "Bạn không ở trong kỳ thi \"%s\"." msgstr "Bạn không ở trong kỳ thi \"%s\"."
#: judge/views/contests.py:732 #: judge/views/contests.py:734
msgid "ContestCalendar requires integer year and month" msgid "ContestCalendar requires integer year and month"
msgstr "Lịch thi yêu cầu giá trị cho năm và tháng là số nguyên" msgstr "Lịch thi yêu cầu giá trị cho năm và tháng là số nguyên"
#: judge/views/contests.py:790 #: judge/views/contests.py:792
#, python-format #, python-format
msgid "Contests in %(month)s" msgid "Contests in %(month)s"
msgstr "Các kỳ thi trong %(month)s" msgstr "Các kỳ thi trong %(month)s"
#: judge/views/contests.py:791 #: judge/views/contests.py:793
msgid "F Y" msgid "F Y"
msgstr "F Y" msgstr "F Y"
#: judge/views/contests.py:851 #: judge/views/contests.py:853
#, python-format #, python-format
msgid "%s Statistics" msgid "%s Statistics"
msgstr "%s Thống kê" msgstr "%s Thống kê"
#: judge/views/contests.py:1159 #: judge/views/contests.py:1161
#, python-format #, python-format
msgid "%s Rankings" msgid "%s Rankings"
msgstr "%s Bảng điểm" msgstr "%s Bảng điểm"
#: judge/views/contests.py:1170 #: judge/views/contests.py:1172
msgid "???" msgid "???"
msgstr "???" msgstr "???"
#: judge/views/contests.py:1197 #: judge/views/contests.py:1199
#, python-format #, python-format
msgid "Your participation in %s" msgid "Your participation in %s"
msgstr "Lần tham gia trong %s" msgstr "Lần tham gia trong %s"
#: judge/views/contests.py:1198 #: judge/views/contests.py:1200
#, python-format #, python-format
msgid "%s's participation in %s" msgid "%s's participation in %s"
msgstr "Lần tham gia của %s trong %s" msgstr "Lần tham gia của %s trong %s"
#: judge/views/contests.py:1212 #: judge/views/contests.py:1214
msgid "Live" msgid "Live"
msgstr "Trực tiếp" msgstr "Trực tiếp"
#: judge/views/contests.py:1231 templates/contest/contest-tabs.html:21 #: judge/views/contests.py:1233 templates/contest/contest-tabs.html:21
msgid "Participation" msgid "Participation"
msgstr "Lần tham gia" msgstr "Lần tham gia"
#: judge/views/contests.py:1280 #: judge/views/contests.py:1282
#, python-format #, python-format
msgid "%s MOSS Results" msgid "%s MOSS Results"
msgstr "%s Kết quả MOSS" msgstr "%s Kết quả MOSS"
#: judge/views/contests.py:1316 #: judge/views/contests.py:1318
#, python-format #, python-format
msgid "Running MOSS for %s..." msgid "Running MOSS for %s..."
msgstr "Đang chạy MOSS cho %s..." msgstr "Đang chạy MOSS cho %s..."
#: judge/views/contests.py:1339 #: judge/views/contests.py:1341
#, python-format #, python-format
msgid "Contest tag: %s" msgid "Contest tag: %s"
msgstr "Nhãn kỳ thi: %s" msgstr "Nhãn kỳ thi: %s"
#: judge/views/contests.py:1354 judge/views/ticket.py:67 #: judge/views/contests.py:1356 judge/views/ticket.py:67
msgid "Issue description" msgid "Issue description"
msgstr "Mô tả vấn đề" msgstr "Mô tả vấn đề"
#: judge/views/contests.py:1397 #: judge/views/contests.py:1399
#, python-format #, python-format
msgid "New clarification for %s" msgid "New clarification for %s"
msgstr "Thông báo mới cho %s" msgstr "Thông báo mới cho %s"
@ -3065,7 +3056,7 @@ msgid "You are not allowed to access this organization."
msgstr "Bạn không được phép chỉnh sửa tổ chức này." msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:245 judge/views/stats.py:184 #: judge/views/organization.py:245 judge/views/stats.py:184
#: templates/contest/list.html:89 templates/problem/list-base.html:91 #: templates/contest/list.html:94 templates/problem/list-base.html:91
#: templates/stats/site.html:33 templates/user/user-left-sidebar.html:4 #: templates/stats/site.html:33 templates/user/user-left-sidebar.html:4
#: templates/user/user-list-tabs.html:6 #: templates/user/user-list-tabs.html:6
msgid "Groups" msgid "Groups"
@ -3212,7 +3203,7 @@ msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:960 templates/blog/blog.html:31 #: judge/views/organization.py:960 templates/blog/blog.html:31
#: templates/comments/content-list.html:53 #: templates/comments/content-list.html:53
#: templates/comments/content-list.html:66 #: templates/comments/content-list.html:66
#: templates/contest/contest-tabs.html:37 templates/contest/list.html:123 #: templates/contest/contest-tabs.html:37 templates/contest/list.html:128
#: templates/contest/tag-title.html:9 templates/flatpages/admin_link.html:3 #: templates/contest/tag-title.html:9 templates/flatpages/admin_link.html:3
#: templates/license.html:10 templates/problem/editorial.html:15 #: templates/license.html:10 templates/problem/editorial.html:15
#: templates/problem/feed/items.html:50 #: templates/problem/feed/items.html:50
@ -3258,7 +3249,7 @@ msgstr "Hướng dẫn cho {0}"
msgid "Editorial for <a href=\"{1}\">{0}</a>" msgid "Editorial for <a href=\"{1}\">{0}</a>"
msgstr "Hướng dẫn cho <a href=\"{1}\">{0}</a>" msgstr "Hướng dẫn cho <a href=\"{1}\">{0}</a>"
#: judge/views/problem.py:458 templates/contest/contest.html:116 #: judge/views/problem.py:458 templates/contest/contest.html:112
#: templates/course/lesson.html:14 #: templates/course/lesson.html:14
#: templates/organization/org-left-sidebar.html:4 #: templates/organization/org-left-sidebar.html:4
#: templates/user/user-about.html:28 templates/user/user-bookmarks.html:35 #: templates/user/user-about.html:28 templates/user/user-bookmarks.html:35
@ -3266,38 +3257,38 @@ msgstr "Hướng dẫn cho <a href=\"{1}\">{0}</a>"
msgid "Problems" msgid "Problems"
msgstr "Bài tập" msgstr "Bài tập"
#: judge/views/problem.py:825 #: judge/views/problem.py:824
msgid "Problem feed" msgid "Problem feed"
msgstr "Bài tập" msgstr "Bài tập"
#: judge/views/problem.py:1023 judge/views/problem.py:1056 #: judge/views/problem.py:1022 judge/views/problem.py:1055
msgid "<h1>You have submitted too many submissions.</h1>" msgid "<h1>You have submitted too many submissions.</h1>"
msgstr "<h1>Bạn nộp quá nhiều bài.</h1>" msgstr "<h1>Bạn nộp quá nhiều bài.</h1>"
#: judge/views/problem.py:1035 #: judge/views/problem.py:1034
msgid "Banned from submitting" msgid "Banned from submitting"
msgstr "Bị cấm nộp bài" msgstr "Bị cấm nộp bài"
#: judge/views/problem.py:1037 #: judge/views/problem.py:1036
msgid "" msgid ""
"You have been declared persona non grata for this problem. You are " "You have been declared persona non grata for this problem. You are "
"permanently barred from submitting this problem." "permanently barred from submitting this problem."
msgstr "Bạn đã bị cấm nộp bài này." msgstr "Bạn đã bị cấm nộp bài này."
#: judge/views/problem.py:1075 #: judge/views/problem.py:1074
msgid "Too many submissions" msgid "Too many submissions"
msgstr "Quá nhiều lần nộp" msgstr "Quá nhiều lần nộp"
#: judge/views/problem.py:1077 #: judge/views/problem.py:1076
msgid "You have exceeded the submission limit for this problem." msgid "You have exceeded the submission limit for this problem."
msgstr "Bạn đã vượt quá số lần nộp cho bài này." msgstr "Bạn đã vượt quá số lần nộp cho bài này."
#: judge/views/problem.py:1162 judge/views/problem.py:1167 #: judge/views/problem.py:1161 judge/views/problem.py:1166
#, python-format #, python-format
msgid "Submit to %(problem)s" msgid "Submit to %(problem)s"
msgstr "Nộp bài cho %(problem)s" msgstr "Nộp bài cho %(problem)s"
#: judge/views/problem.py:1194 #: judge/views/problem.py:1193
msgid "Clone Problem" msgid "Clone Problem"
msgstr "Nhân bản bài tập" msgstr "Nhân bản bài tập"
@ -3749,13 +3740,14 @@ msgstr "Đăng ký"
msgid "spectating" msgid "spectating"
msgstr "đang theo dõi" msgstr "đang theo dõi"
#: templates/base.html:250 #: templates/base.html:250 templates/contest/list.html:195
msgid "Compete" #: templates/contest/list.html:396
msgstr "Thi" msgid "In contest"
msgstr "Trong kỳ thi"
#: templates/base.html:252 #: templates/base.html:252
msgid "General" msgid "Out contest"
msgstr "Chung" msgstr "Ngoài kỳ thi"
#: templates/base.html:259 #: templates/base.html:259
msgid "This site works best with JavaScript enabled." msgid "This site works best with JavaScript enabled."
@ -3766,7 +3758,7 @@ msgstr ""
msgid " posted on %(time)s" msgid " posted on %(time)s"
msgstr "đã đăng vào %(time)s" msgstr "đã đăng vào %(time)s"
#: templates/blog/blog.html:35 templates/contest/contest.html:97 #: templates/blog/blog.html:35 templates/contest/contest.html:93
msgid "Edit in" msgid "Edit in"
msgstr "Chỉnh sửa trong" msgstr "Chỉnh sửa trong"
@ -4020,7 +4012,7 @@ msgstr "Thứ sáu"
msgid "Saturday" msgid "Saturday"
msgstr "Thứ bảy" msgstr "Thứ bảy"
#: templates/contest/clarification.html:52 templates/contest/list.html:227 #: templates/contest/clarification.html:52 templates/contest/list.html:232
#: templates/organization/new.html:10 templates/ticket/new.html:38 #: templates/organization/new.html:10 templates/ticket/new.html:38
msgid "Create" msgid "Create"
msgstr "Tạo mới" msgstr "Tạo mới"
@ -4136,7 +4128,7 @@ msgstr "MOSS"
msgid "Leave contest" msgid "Leave contest"
msgstr "Rời kỳ thi" msgstr "Rời kỳ thi"
#: templates/contest/contest.html:43 templates/contest/list.html:394 #: templates/contest/contest.html:43 templates/contest/list.html:401
msgid "Virtual join" msgid "Virtual join"
msgstr "Tham gia ảo" msgstr "Tham gia ảo"
@ -4156,21 +4148,21 @@ msgstr "Tham gia kỳ thi"
msgid "Login to participate" msgid "Login to participate"
msgstr "Đăng nhập để tham gia" msgstr "Đăng nhập để tham gia"
#: templates/contest/contest.html:101 #: templates/contest/contest.html:97
msgid "Clone" msgid "Clone"
msgstr "Nhân bản" msgstr "Nhân bản"
#: templates/contest/contest.html:122 #: templates/contest/contest.html:118
msgid "AC Rate" msgid "AC Rate"
msgstr "Tỷ lệ AC" msgstr "Tỷ lệ AC"
#: templates/contest/contest.html:123 templates/contest/list.html:265 #: templates/contest/contest.html:119 templates/contest/list.html:270
#: templates/contest/list.html:305 templates/contest/list.html:386 #: templates/contest/list.html:310 templates/contest/list.html:391
#: templates/problem/list.html:24 #: templates/problem/list.html:24
msgid "Users" msgid "Users"
msgstr "Người nộp" msgstr "Người nộp"
#: templates/contest/contest.html:148 templates/problem/list.html:58 #: templates/contest/contest.html:144 templates/problem/list.html:58
#: templates/problem/list.html:133 #: templates/problem/list.html:133
msgid "Editorial" msgid "Editorial"
msgstr "Hướng dẫn" msgstr "Hướng dẫn"
@ -4186,11 +4178,11 @@ msgstr "Rank"
msgid "Name" msgid "Name"
msgstr "Tên" msgstr "Tên"
#: templates/contest/list.html:85 templates/contest/media-js.html:152 #: templates/contest/list.html:86 templates/contest/media-js.html:152
msgid "Are you sure you want to join?" msgid "Are you sure you want to join?"
msgstr "Bạn có chắc tham gia?" msgstr "Bạn có chắc tham gia?"
#: templates/contest/list.html:86 #: templates/contest/list.html:87
msgid "" msgid ""
"Joining a contest for the first time starts your timer, after which it " "Joining a contest for the first time starts your timer, after which it "
"becomes unstoppable." "becomes unstoppable."
@ -4198,92 +4190,96 @@ msgstr ""
"Tham gia kỳ thi lần đầu sẽ kích hoạt thời gian đếm ngược, không thể dừng lại " "Tham gia kỳ thi lần đầu sẽ kích hoạt thời gian đếm ngược, không thể dừng lại "
"sau đó." "sau đó."
#: templates/contest/list.html:117 #: templates/contest/list.html:89 templates/contest/media-js.html:155
msgid "By joining in this contest, you will automatically leave contest"
msgstr "Khi tham gia kỳ thi này, bạn sẽ tự động rời khỏi kỳ thi"
#: templates/contest/list.html:122
msgid "hidden" msgid "hidden"
msgstr "ẩn" msgstr "ẩn"
#: templates/contest/list.html:129 #: templates/contest/list.html:134
msgid "private" msgid "private"
msgstr "riêng tư" msgstr "riêng tư"
#: templates/contest/list.html:141 #: templates/contest/list.html:146
msgid "rated" msgid "rated"
msgstr "rated" msgstr "rated"
#: templates/contest/list.html:160 templates/contest/list.html:167 #: templates/contest/list.html:165 templates/contest/list.html:172
msgid "Start" msgid "Start"
msgstr "Bắt đầu" msgstr "Bắt đầu"
#: templates/contest/list.html:163 #: templates/contest/list.html:168
msgid "End" msgid "End"
msgstr "Kết thúc" msgstr "Kết thúc"
#: templates/contest/list.html:173 #: templates/contest/list.html:178
#, python-format #, python-format
msgid "%(time_limit)s window" msgid "%(time_limit)s window"
msgstr "Cửa sổ thi dài %(time_limit)s" msgstr "Cửa sổ thi dài %(time_limit)s"
#: templates/contest/list.html:175 #: templates/contest/list.html:180
#, python-format #, python-format
msgid "%(duration)s long" msgid "%(duration)s long"
msgstr "Kéo dài %(duration)s" msgstr "Kéo dài %(duration)s"
#: templates/contest/list.html:194 #: templates/contest/list.html:200
msgid "Spectate" msgid "Spectate"
msgstr "Theo dõi" msgstr "Theo dõi"
#: templates/contest/list.html:200 templates/organization/home.html:23 #: templates/contest/list.html:206 templates/organization/home.html:23
msgid "Join" msgid "Join"
msgstr "Tham gia" msgstr "Tham gia"
#: templates/contest/list.html:209 #: templates/contest/list.html:214
msgid "Search contests..." msgid "Search contests..."
msgstr "Tìm kiếm kỳ thi..." msgstr "Tìm kiếm kỳ thi..."
#: templates/contest/list.html:219 templates/course/grades.html:84 #: templates/contest/list.html:224 templates/course/grades.html:84
#: templates/internal/problem/problem.html:34 #: templates/internal/problem/problem.html:34
msgid "Search" msgid "Search"
msgstr "Tìm kiếm" msgstr "Tìm kiếm"
#: templates/contest/list.html:223 #: templates/contest/list.html:228
msgid "Hide organization contests" msgid "Hide organization contests"
msgstr "Ẩn các kỳ thi riêng tư của nhóm" msgstr "Ẩn các kỳ thi riêng tư của nhóm"
#: templates/contest/list.html:235 #: templates/contest/list.html:240
msgid "Active Contests" msgid "Active Contests"
msgstr "Kỳ thi bạn đang tham gia" msgstr "Kỳ thi bạn đang tham gia"
#: templates/contest/list.html:251 #: templates/contest/list.html:257
#, python-format #, python-format
msgid "Window ends in %(countdown)s" msgid "Window ends in %(countdown)s"
msgstr "Cửa số thi còn %(countdown)s" msgstr "Cửa số thi còn %(countdown)s"
#: templates/contest/list.html:254 templates/contest/list.html:294 #: templates/contest/list.html:260 templates/contest/list.html:300
#, python-format #, python-format
msgid "Ends in %(countdown)s" msgid "Ends in %(countdown)s"
msgstr "Kết thúc trong %(countdown)s" msgstr "Kết thúc trong %(countdown)s"
#: templates/contest/list.html:279 #: templates/contest/list.html:284
msgid "Ongoing Contests" msgid "Ongoing Contests"
msgstr "Kỳ thi đang diễn ra" msgstr "Kỳ thi đang diễn ra"
#: templates/contest/list.html:316 #: templates/contest/list.html:321
msgid "There is no ongoing contest at this time." msgid "There is no ongoing contest at this time."
msgstr "Không có kỳ thi nào đang diễn ra hiện tại." msgstr "Không có kỳ thi nào đang diễn ra hiện tại."
#: templates/contest/list.html:323 #: templates/contest/list.html:328
msgid "Upcoming Contests" msgid "Upcoming Contests"
msgstr "Kỳ thi sắp tới" msgstr "Kỳ thi sắp tới"
#: templates/contest/list.html:353 #: templates/contest/list.html:358
msgid "There is no scheduled contest at this time." msgid "There is no scheduled contest at this time."
msgstr "Không có kỳ thi nào được lên lịch hiện tại." msgstr "Không có kỳ thi nào được lên lịch hiện tại."
#: templates/contest/list.html:360 #: templates/contest/list.html:365
msgid "Past Contests" msgid "Past Contests"
msgstr "Kỳ thi trong quá khứ" msgstr "Kỳ thi trong quá khứ"
#: templates/contest/list.html:407 #: templates/contest/list.html:414
msgid "There is no past contest." msgid "There is no past contest."
msgstr "Không có kỳ thi nào trong quá khứ." msgstr "Không có kỳ thi nào trong quá khứ."
@ -6091,6 +6087,18 @@ msgstr "Thông tin"
msgid "Check all" msgid "Check all"
msgstr "Chọn tất cả" msgstr "Chọn tất cả"
#~ msgid "Already in contest"
#~ msgstr "Đã ở trong kỳ thi"
#~ msgid "You are already in a contest: \"%s\"."
#~ msgstr "Bạn đã ở trong kỳ thi: \"%s\"."
#~ msgid "Compete"
#~ msgstr "Thi"
#~ msgid "General"
#~ msgstr "Chung"
#~ msgid "custom validator file" #~ msgid "custom validator file"
#~ msgstr "file trình chấm" #~ msgstr "file trình chấm"

View file

@ -247,9 +247,9 @@
</div> </div>
<div id="contest-info-toggle" class="{{'contest-info-toggle-mode-on' if request.contest_mode else 'contest-info-toggle-mode-off'}}"> <div id="contest-info-toggle" class="{{'contest-info-toggle-mode-on' if request.contest_mode else 'contest-info-toggle-mode-off'}}">
{% if request.contest_mode %} {% if request.contest_mode %}
<i class="fa fa-toggle-on white"></i> {{_('Compete')}} <i class="fa fa-toggle-on white"></i> {{_('In contest')}}
{% else %} {% else %}
<i class="fa fa-toggle-off white"></i> {{_('General')}} <i class="fa fa-toggle-off white"></i> {{_('Out contest')}}
{% endif %} {% endif %}
</div> </div>
</div> </div>

View file

@ -83,8 +83,12 @@
$('.contest-tag').find('a[data-featherlight]').featherlight(); $('.contest-tag').find('a[data-featherlight]').featherlight();
$('.join-warning').click(function () { $('.join-warning').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' + let q = '{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}'); '{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}';
{% if request.in_contest %}
q += " {{ _('By joining in this contest, you will automatically leave contest') }} \"{{ request.participation.contest.name }}\". ";
{% endif %}
return confirm(q);
}); });
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'}) $('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'})
@ -187,20 +191,20 @@
{% endmacro %} {% endmacro %}
{% macro contest_join(contest, request) %} {% macro contest_join(contest, request) %}
{% if not request.in_contest %} {% if request.in_contest and request.participation.contest == contest %}
{% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %} <button class="small" disabled>{{ _('In contest') }}</button>
<form action="{{ url('contest_join', contest.key) }}" method="post"> {% elif request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
{% csrf_token %} <form action="{{ url('contest_join', contest.key) }}" method="post">
<input type="submit" class="unselectable button full small" {% csrf_token %}
value="{{ _('Spectate') }}"> <input type="submit" class="unselectable button full small"
</form> value="{{ _('Spectate') }}">
{% else %} </form>
<form action="{{ url('contest_join', contest.key) }}" method="post"> {% else %}
{% csrf_token %} <form action="{{ url('contest_join', contest.key) }}" method="post">
<input type="submit" class="unselectable button full small join-warning" {% csrf_token %}
value="{{ _('Join') }}"> <input type="submit" class="unselectable button full small join-warning"
</form> value="{{ _('Join') }}">
{% endif %} </form>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
@ -387,15 +391,17 @@
<div class="contest-title"> {{ _('Users') }} </div> <div class="contest-title"> {{ _('Users') }} </div>
{{ user_count(contest, request.user) }} {{ user_count(contest, request.user) }}
</div> </div>
{% if not request.in_contest %} <div class="participate-button">
<div class="participate-button"> {% if request.in_contest and request.participation.contest == contest %}
<button class="small" disabled>{{ _('In contest') }}</button>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post"> <form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="unselectable button full small" <input type="submit" class="unselectable button full small"
value="{{ _('Virtual join') }}"> value="{{ _('Virtual join') }}">
</form> </form>
</div> {% endif %}
{% endif %} </div>
</div> </div>
{% endfor %} {% endfor %}
{% if page_obj and page_obj.num_pages > 1 %} {% if page_obj and page_obj.num_pages > 1 %}

View file

@ -149,8 +149,12 @@
}); });
$('.first-join').click(function () { $('.first-join').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' + let q = '{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest starts your timer, after which it becomes unstoppable.') }}'); '{{ _('Joining a contest starts your timer, after which it becomes unstoppable.') }}';
{% if current_contest %}
q += " {{ _('By joining in this contest, you will automatically leave contest') }} \"{{ current_contest.name }}\". ";
{% endif %}
return confirm(q);
}); });
var url = '{{ url('contest_participation', contest.key, '__username__') }}'; var url = '{{ url('contest_participation', contest.key, '__username__') }}';