From 30f37262cc54fc9f25786e825125641119696fc9 Mon Sep 17 00:00:00 2001 From: Le Duy Thuc Date: Fri, 13 Dec 2024 01:49:35 +0000 Subject: [PATCH] ballon color --- judge/views/contests.py | 15 +++++++++++++++ templates/contest/balloons.html | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/judge/views/contests.py b/judge/views/contests.py index 7e0eefe1c..c76ab700a 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -1187,6 +1187,21 @@ def get_context_data(self, **kwargs): context = super(ContestBalloons, self).get_context_data(**kwargs) context['balloons_done'] = max(0, int(self.request.GET.get('balloons_done', 0)) - 1) context['accept_submissions'] = self.get_accepted_submissions()[context['balloons_done']:] + context['color_map'] = { + 'icpc_g': 'đỏ', + 'icpc_c': 'xanh dương', + 'icpc_f': 'xanh ngọc ', + 'icpc_b': 'xanh lá nhạt', + 'icpc_d': 'tím', + 'icpc_l': 'hồng đậm', + 'icpc_k': 'vàng', + 'icpc_j': 'hồng nhạt', + 'icpc_m': 'đen', + 'icpc_i': 'xanh lá đậm', + 'icpc_h': 'cam', + 'icpc_a': 'xanh dương nhạt', + 'icpc_e': 'xanh dương nhạt', + } return context def dispatch(self, request, *args, **kwargs): diff --git a/templates/contest/balloons.html b/templates/contest/balloons.html index e39501dd7..bbd1d84d6 100644 --- a/templates/contest/balloons.html +++ b/templates/contest/balloons.html @@ -84,6 +84,11 @@ $('tr').click(mark_row); $('#scroll-to-unmarked').click(scroll_to_unmarked); }); + + // reload each 30 secs + setInterval(function() { + location.reload(); + }, 30000); {% endblock %} @@ -100,6 +105,7 @@ {{ _('SubID.') }} {{ _('TEAM') }} {{ _('PROBLEM') }} + {{ _('COLOR') }} @@ -116,6 +122,13 @@ {{ submission.problem.code }} + + {% if submission.problem.code in color_map %} + {{ color_map[submission.problem.code] }} + {% else %} + Unknown + {% endif %} + {% endfor %}