From 444cbc4324a3dcad67aee12436e05c347026de15 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sat, 12 Sep 2015 22:00:24 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=AF=94=E8=B5=9B?= =?UTF-8?q?=E6=8E=92=E5=90=8D=E7=9A=84=E5=B0=81=E6=A6=9C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8Crank=E9=A1=B5=E9=9D=A2=E4=BB=8Eredis=E4=B8=AD=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E6=8E=92=E5=90=8D=E4=BF=A1=E6=81=AF=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E5=90=91mysql=E6=9F=A5=E8=AF=A2=EF=BC=8C=E5=B0=81?= =?UTF-8?q?=E6=A6=9C=E5=90=8Eredis=E4=B8=AD=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=BE=BF=E4=B8=8D=E5=86=8D=E6=9B=B4=E6=96=B0=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/serializers.py | 4 +- contest/views.py | 46 +++++++++++++------ template/src/oj/contest/contest_rank.html | 7 +++ template/src/oj/contest/submissions_list.html | 3 +- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/contest/serializers.py b/contest/serializers.py index 65b2fe7db..8f3bf0bc0 100644 --- a/contest/serializers.py +++ b/contest/serializers.py @@ -13,7 +13,7 @@ class CreateContestSerializer(serializers.Serializer): description = serializers.CharField(max_length=5000) mode = serializers.IntegerField() contest_type = serializers.IntegerField() - show_rank = serializers.BooleanField() + real_time_rank = serializers.BooleanField() show_user_submission = serializers.BooleanField() password = serializers.CharField(max_length=30, required=False, default=None) start_time = serializers.DateTimeField() @@ -47,7 +47,7 @@ class EditContestSerializer(serializers.Serializer): description = serializers.CharField(max_length=10000) mode = serializers.IntegerField() contest_type = serializers.IntegerField() - show_rank = serializers.BooleanField() + real_time_rank = serializers.BooleanField() show_user_submission = serializers.BooleanField() password = serializers.CharField(max_length=30, required=False, default=None) start_time = serializers.DateTimeField() diff --git a/contest/views.py b/contest/views.py index ad5ccf76a..11d22f0f6 100644 --- a/contest/views.py +++ b/contest/views.py @@ -24,6 +24,8 @@ CreateContestProblemSerializer, ContestProblemSerializer, EditContestProblemSerializer, ContestPasswordVerifySerializer, EditContestProblemSerializer) +from oj.settings import REDIS_CACHE +import redis class ContestAdminAPIView(APIView): @@ -61,7 +63,7 @@ def post(self, request): try: contest = Contest.objects.create(title=data["title"], description=data["description"], mode=data["mode"], contest_type=data["contest_type"], - show_rank=data["show_rank"], password=data["password"], + real_time_rank=data["real_time_rank"], password=data["password"], show_user_submission=data["show_user_submission"], start_time=dateparse.parse_datetime(data["start_time"]), end_time=dateparse.parse_datetime(data["end_time"]), @@ -115,7 +117,7 @@ def put(self, request): contest.description = data["description"] contest.mode = data["mode"] contest.contest_type = data["contest_type"] - contest.show_rank = data["show_rank"] + contest.real_time_rank = data["real_time_rank"] contest.show_user_submission = data["show_user_submission"] contest.start_time = dateparse.parse_datetime(data["start_time"]) contest.end_time = dateparse.parse_datetime(data["end_time"]) @@ -397,19 +399,33 @@ def _cmp(x, y): def contest_rank_page(request, contest_id): contest = Contest.objects.get(id=contest_id) contest_problems = ContestProblem.objects.filter(contest=contest).order_by("sort_index") - result = ContestSubmission.objects.filter(contest=contest).values("user_id").\ - annotate(total_submit=Sum("total_submission_number")) - for i in range(0, len(result)): - # 这个人所有的提交 - submissions = ContestSubmission.objects.filter(user_id=result[i]["user_id"], contest_id=contest_id) - result[i]["submissions"] = {} - for item in submissions: - result[i]["submissions"][item.problem_id] = item - result[i]["total_ac"] = submissions.filter(ac=True).count() - result[i]["user"] = User.objects.get(id=result[i]["user_id"]) - result[i]["total_time"] = submissions.filter(ac=True).aggregate(total_time=Sum("total_time"))["total_time"] + + r = redis.Redis(host=REDIS_CACHE["host"], port=REDIS_CACHE["port"], db=REDIS_CACHE["db"]) + if contest.real_time_rank: + # 更新rank + result = ContestSubmission.objects.filter(contest=contest).values("user_id"). \ + annotate(total_submit=Sum("total_submission_number")) + for i in range(0, len(result)): + # 这个人所有的提交 + submissions = ContestSubmission.objects.filter(user_id=result[i]["user_id"], contest_id=contest_id) + result[i]["submissions"] = {} + for item in submissions: + result[i]["submissions"][item.problem_id] = item + result[i]["total_ac"] = submissions.filter(ac=True).count() + result[i]["user"] = User.objects.get(id=result[i]["user_id"]) + result[i]["total_time"] = submissions.filter(ac=True).aggregate(total_time=Sum("total_time"))["total_time"] + result = sorted(result, cmp=_cmp, reverse=True) + r.set("contest_rank_" + contest_id, json.dumps(list(result))) + else: + # 从缓存读取排名信息 + result = r.get("contest_rank_" + contest_id) + if result: + result = json.loads(result) + else: + result = [] return render(request, "oj/contest/contest_rank.html", {"contest": contest, "contest_problems": contest_problems, - "result": sorted(result, cmp=_cmp, reverse=True), - "auto_refresh": request.GET.get("auto_refresh", None) == "true"}) + "result": result, + "auto_refresh": request.GET.get("auto_refresh", None) == "true", + "real_time_rank": contest.real_time_rank}) diff --git a/template/src/oj/contest/contest_rank.html b/template/src/oj/contest/contest_rank.html index ac2bb1537..72ae06700 100644 --- a/template/src/oj/contest/contest_rank.html +++ b/template/src/oj/contest/contest_rank.html @@ -20,6 +20,13 @@
+

排名( + {% if real_time_rank %} + 实时 + {% else %} + 已封榜 + {% endif %}) +

{% if result %} diff --git a/template/src/oj/contest/submissions_list.html b/template/src/oj/contest/submissions_list.html index 1424bb102..1deba9cb2 100644 --- a/template/src/oj/contest/submissions_list.html +++ b/template/src/oj/contest/submissions_list.html @@ -67,7 +67,8 @@ {% for item in submissions %} - {% ifequal item.user_id request.user.id %} + + {% if item.user_id == request.user.id and request.user.admin_type == 2%} {% else %} From 376257beeda899ed011091e620ab83e82104b882 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 08:58:09 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E6=95=B4=E7=90=86=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- submission/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/submission/views.py b/submission/views.py index 19f3c2921..6e3799bf7 100644 --- a/submission/views.py +++ b/submission/views.py @@ -21,7 +21,6 @@ from .serializers import CreateSubmissionSerializer, SubmissionSerializer, SubmissionhareSerializer - class SubmissionAPIView(APIView): @login_required def post(self, request): @@ -81,7 +80,8 @@ def problem_my_submissions_list_page(request, problem_id): except Problem.DoesNotExist: return error_page(request, u"问题不存在") - submissions = Submission.objects.filter(user_id=request.user.id, problem_id=problem.id, contest_id__isnull=True).order_by("-create_time"). \ + submissions = Submission.objects.filter(user_id=request.user.id, problem_id=problem.id, + contest_id__isnull=True).order_by("-create_time"). \ values("id", "result", "create_time", "accepted_answer_time", "language") return render(request, "oj/problem/my_submissions_list.html", @@ -196,7 +196,7 @@ def my_submission_list_page(request, page=1): return render(request, "oj/submission/my_submissions_list.html", {"submissions": current_page, "page": int(page), "previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20, - "announcements": announcements, "filter":filter}) + "announcements": announcements, "filter": filter}) class SubmissionShareAPIView(APIView): @@ -212,4 +212,4 @@ def post(self, request): submission.save() return success_response(submission.shared) else: - return serializer_invalid_response(serializer) \ No newline at end of file + return serializer_invalid_response(serializer) From d3b05d2dea9030d20bc1b3c463ff7df1037a3eba Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 08:59:58 +0800 Subject: [PATCH 03/32] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97,logger?= =?UTF-8?q?=E6=98=AFapp=5Finfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problem/views.py | 8 ++++++-- utils/views.py | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/problem/views.py b/problem/views.py index 94e3a7a93..ca27cdb49 100644 --- a/problem/views.py +++ b/problem/views.py @@ -13,13 +13,16 @@ from django.conf import settings + from announcement.models import Announcement from utils.shortcuts import (serializer_invalid_response, error_response, success_response, paginate, rand_str, error_page) from .serizalizers import (CreateProblemSerializer, EditProblemSerializer, ProblemSerializer, ProblemTagSerializer, CreateProblemTagSerializer) from .models import Problem, ProblemTag +import logging +logger = logging.getLogger("app_info") def problem_page(request, problem_id): try: @@ -151,8 +154,9 @@ def post(self, request): with open(tmp_zip, "wb") as test_case_zip: for chunk in f: test_case_zip.write(chunk) - except IOError: - return error_response(u"上传错误,写入临时目录失败") + except IOError as e: + logger.error(e) + return error_response(u"上传失败") test_case_file = zipfile.ZipFile(tmp_zip, 'r') name_list = test_case_file.namelist() diff --git a/utils/views.py b/utils/views.py index 87beeb4f3..cb3b2cd20 100644 --- a/utils/views.py +++ b/utils/views.py @@ -5,7 +5,9 @@ from django.conf import settings from utils.shortcuts import rand_str +import logging +logger = logging.getLogger("app_info") class SimditorImageUploadAPIView(APIView): def post(self, request): @@ -22,7 +24,8 @@ def post(self, request): with open(image_dir, "wb") as imageFile: for chunk in img: imageFile.write(chunk) - except IOError: + except IOError as e: + logger.error(e) return Response(data={ "success": True, "msg": "上传错误", From 5b15b64a17afe85a2c3120feb1321aecf93ecc63 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 10:30:55 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=A6=E7=BB=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- submission/views.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/submission/views.py b/submission/views.py index 6e3799bf7..45e1875cc 100644 --- a/submission/views.py +++ b/submission/views.py @@ -114,9 +114,6 @@ def my_submission(request, submission_id): except Submission.DoesNotExist: return error_page(request, u"提交不存在") - if submission.user_id != request.user.id and not submission.shared: - return error_page(request, u"提交不存在") - if submission.contest_id: try: problem = ContestProblem.objects.get(id=submission.problem_id, From 1808426a738075d379430bc6fac80a7c4b85adcc Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 11:18:28 +0800 Subject: [PATCH 05/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug,=E7=BC=A9=E8=BF=9B?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=BC=95=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contest/views.py b/contest/views.py index 11d22f0f6..caf572db4 100644 --- a/contest/views.py +++ b/contest/views.py @@ -1,8 +1,6 @@ # coding=utf-8 import json import datetime -from functools import wraps -from django.utils.timezone import now from django.shortcuts import render from django.db import IntegrityError from django.utils import dateparse @@ -414,7 +412,7 @@ def contest_rank_page(request, contest_id): result[i]["total_ac"] = submissions.filter(ac=True).count() result[i]["user"] = User.objects.get(id=result[i]["user_id"]) result[i]["total_time"] = submissions.filter(ac=True).aggregate(total_time=Sum("total_time"))["total_time"] - result = sorted(result, cmp=_cmp, reverse=True) + result = sorted(result, cmp=_cmp, reverse=True) r.set("contest_rank_" + contest_id, json.dumps(list(result))) else: # 从缓存读取排名信息 From 66cef75bed231c5cf3c1d4fb2729e8fd5ccb5698 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 19:49:59 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AAac=E8=80=85=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contest/models.py b/contest/models.py index 258ee19c8..190fce3f2 100644 --- a/contest/models.py +++ b/contest/models.py @@ -94,6 +94,8 @@ class ContestSubmission(models.Model): ac_time = models.IntegerField(default=0) # 总的时间,用于acm 类型的,也需要保存罚时 total_time = models.IntegerField(default=0) + # 第一个解出此题目 + first_achieved = models.BooleanField() class Meta: db_table = "contest_submission" From 25e2d0ca8dc3f61a14078846d150379e0c7a4989 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 19:50:23 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=AF=94=E8=B5=9Branklist=E4=B8=AD=E8=A1=A8=E7=A4=BA=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E7=8A=B6=E6=80=81=E7=9A=84=E9=A2=9C=E8=89=B2=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F,=E6=B7=BB=E5=8A=A0=E7=AC=AC=E4=B8=80=E4=B8=AAac?= =?UTF-8?q?=E7=9A=84=E9=A2=9C=E8=89=B2,=E6=96=87=E5=AD=97=E8=89=B2?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=B8=BA=E7=99=BD=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/css/oj.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/static/src/css/oj.css b/static/src/css/oj.css index 08b6d02b6..04f9da2b1 100644 --- a/static/src/css/oj.css +++ b/static/src/css/oj.css @@ -107,4 +107,19 @@ li.list-group-item { #about-acm-logo{ width: 40%; +} + +.rank .first-achieved{ + background: #43CD80; + color: white; +} + +.rank .ac{ + background: #3c763d; + color: white; +} + +.rank .failed{ + background: #a94442; + color: white; } \ No newline at end of file From 49b4068757a89c0713b9b2ce38fa539b558f2996 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 19:50:39 +0800 Subject: [PATCH 08/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AF=94=E8=B5=9B?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=BB=9F=E8=AE=A1=E9=80=BB=E8=BE=91,?= =?UTF-8?q?=E9=87=8D=E5=A4=8Dac=E4=B8=8D=E8=AE=A1=E5=85=A5=E6=80=BB?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mq/scripts/info.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mq/scripts/info.py b/mq/scripts/info.py index a3e13b9fc..5e3691efd 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -8,7 +8,7 @@ from submission.models import Submission from problem.models import Problem from contest.models import ContestProblem, Contest, ContestSubmission - +from account.models import User logger = logging.getLogger("app_info") @@ -53,10 +53,8 @@ def listen_task(self): contest_submission = ContestSubmission.objects.get(user_id=submission.user_id, contest=contest, problem_id=contest_problem.id) # 提交次数加1 - contest_submission.total_submission_number += 1 if submission.result == result["accepted"]: - # 避免这道题已经 ac 了,但是又重新提交了一遍 if not contest_submission.ac: # 这种情况是这个题目前处于错误状态,就使用已经存储了的罚时加上这道题的实际用时 @@ -66,6 +64,7 @@ def listen_task(self): # logger.debug(int((submission.create_time - contest.start_time).total_seconds() / 60)) contest_submission.ac_time = int((submission.create_time - contest.start_time).total_seconds() / 60) contest_submission.total_time += contest_submission.ac_time + contest_submission.total_submission_number += 1 # 标记为已经通过 contest_submission.ac = True # contest problem ac 计数器加1 @@ -73,6 +72,7 @@ def listen_task(self): else: # 如果这个提交是错误的,就罚时20分钟 contest_submission.total_time += 20 + contest_submission.total_submission_number += 1 contest_submission.save() contest_problem.save() except ContestSubmission.DoesNotExist: From de6ed31216997d08ad46e4a67b85d1f88cfa8aa3 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 19:50:49 +0800 Subject: [PATCH 09/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AF=94=E8=B5=9Brankl?= =?UTF-8?q?ist=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F,=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F,=E4=B8=BA=E4=BA=86?= =?UTF-8?q?=E4=BE=BF=E4=BA=8E=E7=BC=93=E5=AD=98,=E7=A8=8D=E5=BE=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=98=BE=E7=A4=BA=E7=9A=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/views.py | 18 +++++++++++---- template/src/oj/contest/contest_rank.html | 27 ++++++++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/contest/views.py b/contest/views.py index caf572db4..3ea33e6fe 100644 --- a/contest/views.py +++ b/contest/views.py @@ -356,7 +356,6 @@ def contest_list_page(request, page=1): if request.user.is_authenticated and join: contests = contests.filter(Q(contest_type__in=[1, 2]) | Q(groups__in=request.user.group_set.all())). \ filter(end_time__gt=datetime.datetime.now(), start_time__lt=datetime.datetime.now()) - paginator = Paginator(contests, 20) try: current_page = paginator.page(int(page)) @@ -407,10 +406,21 @@ def contest_rank_page(request, contest_id): # 这个人所有的提交 submissions = ContestSubmission.objects.filter(user_id=result[i]["user_id"], contest_id=contest_id) result[i]["submissions"] = {} - for item in submissions: - result[i]["submissions"][item.problem_id] = item + result[i]["problems"] = [] + for problem in contest_problems: + try: + status = submissions.get(problem=problem) + result[i]["problems"].append({ + "first_achieved":status.first_achivevd, + "ac": status.ac, + "failed_number": status.total_submission_number, + "ac_time": status.ac_time}) + if status.ac: + result[i]["problem"][-1].failed_number -= 1 + except ContestSubmission.DoesNotExist: + result[i]["problems"].append({}) result[i]["total_ac"] = submissions.filter(ac=True).count() - result[i]["user"] = User.objects.get(id=result[i]["user_id"]) + result[i]["username"] = User.objects.get(id=result[i]["user_id"]).username result[i]["total_time"] = submissions.filter(ac=True).aggregate(total_time=Sum("total_time"))["total_time"] result = sorted(result, cmp=_cmp, reverse=True) r.set("contest_rank_" + contest_id, json.dumps(list(result))) diff --git a/template/src/oj/contest/contest_rank.html b/template/src/oj/contest/contest_rank.html index 72ae06700..a23ff9c8a 100644 --- a/template/src/oj/contest/contest_rank.html +++ b/template/src/oj/contest/contest_rank.html @@ -41,16 +41,33 @@

排名( {% endfor %}

- + {% for item in result %} - + - {% for problem in contest_problems %} - {% endfor %} From c47d23eb0a423017c6384c85f18c7760a6820fe2 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 19:51:28 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E5=88=A0=E6=8E=89=E7=94=A8=E4=BA=8Erankl?= =?UTF-8?q?ist=E7=9A=84=E4=B8=A4=E4=B8=AA=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=99=A8,=E5=9B=A0=E4=B8=BA=E4=B8=BA?= =?UTF-8?q?=E4=BA=86=E7=BC=93=E5=AD=98=E6=98=AFjson=20dump=20=E6=96=B9?= =?UTF-8?q?=E4=BE=BF,=E6=8A=8A=E5=8E=9F=E6=9C=AC=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=87=8C=E7=9A=84=E8=AE=A1=E7=AE=97=E6=8F=90?= =?UTF-8?q?=E5=88=B0=E5=89=8D=E8=BE=B9=E5=8E=BB=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/templatetags/submission.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/utils/templatetags/submission.py b/utils/templatetags/submission.py index 2e734179e..aeb11a3e1 100644 --- a/utils/templatetags/submission.py +++ b/utils/templatetags/submission.py @@ -29,33 +29,7 @@ def translate_result_class(value): return "danger" -def get_contest_submission_problem_detail(contest_problem, my_submission): - if contest_problem.id in my_submission: - submission = my_submission[contest_problem.id] - if submission.ac: - # 只提交了一次就AC - if submission.total_submission_number == 1: - return str(submission.ac_time) + " min" - else: - return "20 min × " + str(submission.total_submission_number - 1) + " WA + " + str(submission.ac_time) + " min" - return str(submission.total_submission_number) + " WA" - else: - return "" - - -def get_submission_problem_result_class(contest_problem, my_submission): - if contest_problem.id in my_submission: - submission = my_submission[contest_problem.id] - if submission.ac: - return "success" - else: - return "danger" - else: - return "" - register = template.Library() register.filter("translate_result", translate_result) register.filter("translate_language", translate_language) register.filter("translate_result_class", translate_result_class) -register.simple_tag(get_contest_submission_problem_detail, name="submission_problem") -register.simple_tag(get_submission_problem_result_class, name="submission_problem_result_class") \ No newline at end of file From c179d183c862e230ad8fe1ab3923aa1b4d9bca29 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 20:00:42 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC=E4=BB=A5?= =?UTF-8?q?=E4=BE=BF=E4=BA=8Emigrate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contest/models.py b/contest/models.py index 190fce3f2..8b8a2606f 100644 --- a/contest/models.py +++ b/contest/models.py @@ -95,7 +95,7 @@ class ContestSubmission(models.Model): # 总的时间,用于acm 类型的,也需要保存罚时 total_time = models.IntegerField(default=0) # 第一个解出此题目 - first_achieved = models.BooleanField() + first_achieved = models.BooleanField(default=False) class Meta: db_table = "contest_submission" From 34f886d99041a3a6d901cfc6ff7baabe667584ef Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 21:03:50 +0800 Subject: [PATCH 12/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtypo,=E4=BF=AE=E6=94=B9?= =?UTF-8?q?rank=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/views.py | 5 ++-- static/src/css/oj.css | 12 +-------- template/src/oj/contest/contest_rank.html | 32 +++++++---------------- 3 files changed, 13 insertions(+), 36 deletions(-) diff --git a/contest/views.py b/contest/views.py index 3ea33e6fe..a5a45c427 100644 --- a/contest/views.py +++ b/contest/views.py @@ -396,7 +396,6 @@ def _cmp(x, y): def contest_rank_page(request, contest_id): contest = Contest.objects.get(id=contest_id) contest_problems = ContestProblem.objects.filter(contest=contest).order_by("sort_index") - r = redis.Redis(host=REDIS_CACHE["host"], port=REDIS_CACHE["port"], db=REDIS_CACHE["db"]) if contest.real_time_rank: # 更新rank @@ -411,12 +410,12 @@ def contest_rank_page(request, contest_id): try: status = submissions.get(problem=problem) result[i]["problems"].append({ - "first_achieved":status.first_achivevd, + "first_achieved":status.first_achieved, "ac": status.ac, "failed_number": status.total_submission_number, "ac_time": status.ac_time}) if status.ac: - result[i]["problem"][-1].failed_number -= 1 + result[i]["problems"][-1]["failed_number"] -= 1 except ContestSubmission.DoesNotExist: result[i]["problems"].append({}) result[i]["total_ac"] = submissions.filter(ac=True).count() diff --git a/static/src/css/oj.css b/static/src/css/oj.css index 04f9da2b1..86748c2df 100644 --- a/static/src/css/oj.css +++ b/static/src/css/oj.css @@ -110,16 +110,6 @@ li.list-group-item { } .rank .first-achieved{ - background: #43CD80; - color: white; + background: #33CC99; } -.rank .ac{ - background: #3c763d; - color: white; -} - -.rank .failed{ - background: #a94442; - color: white; -} \ No newline at end of file diff --git a/template/src/oj/contest/contest_rank.html b/template/src/oj/contest/contest_rank.html index a23ff9c8a..62faf0b0f 100644 --- a/template/src/oj/contest/contest_rank.html +++ b/template/src/oj/contest/contest_rank.html @@ -25,18 +25,18 @@

排名( 实时 {% else %} 已封榜 - {% endif %}) -

- {% if result %} -
{{ forloop.counter |add:start_id }}
{{ forloop.counter }}{{ item.user.username }}{{ item.username }} {{ item.total_ac }} / {{ item.total_submit }} {% if item.total_time %}{{ item.total_time }} min{% else %}--{% endif %} - {% submission_problem problem item.submissions %} + {% for problem in item.problem %} + + {% if problem.ac %} + {{ problem.ac_time }}min + {% endif %} + {% if problem.failed_number %} + (-{{ problem.failed_number }}) + {% endif %}
+ {% endif %}) + + {% if result %} +
- - - + + + {% for item in contest_problems %} - {% endfor %} @@ -48,20 +48,8 @@

排名(

- {% for problem in item.problem %} - - + {% for problem in item.problems %} {% for problem in item.problems %} -
#用户名AC / 总提交用时 + 罚时用户名AC / 总提交用时 + 罚时{{ item.sort_index }} + {{ item.sort_index }}
{{ item.username }} {{ item.total_ac }} / {{ item.total_submit }} {% if item.total_time %}{{ item.total_time }} min{% else %}--{% endif %} + {% for problem in item.problems %} + {% if problem.ac %} {{ problem.ac_time }}min {% endif %} From 86c70eb8bd9ffaeb3ece85af146a27fbf74a9184 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 21:31:38 +0800 Subject: [PATCH 13/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9rank=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=20hh:mm:ss,=E4=BF=AE?= =?UTF-8?q?=E6=94=B9rank=E9=A1=B5=E9=9D=A2=E6=97=B6=E9=97=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=20hh:mm:ss,ContestSubmission=E4=B8=AD=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BB=A5=E7=A7=92=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/models.py | 2 +- contest/views.py | 19 ++++++++++++++++--- mq/scripts/info.py | 6 +++--- template/src/oj/contest/contest_rank.html | 6 ++---- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/contest/models.py b/contest/models.py index 8b8a2606f..d880f06a7 100644 --- a/contest/models.py +++ b/contest/models.py @@ -90,7 +90,7 @@ class ContestSubmission(models.Model): total_submission_number = models.IntegerField(default=1) # 这道题是 AC 还是没过 ac = models.BooleanField() - # ac 用时 + # ac 用时以秒计 ac_time = models.IntegerField(default=0) # 总的时间,用于acm 类型的,也需要保存罚时 total_time = models.IntegerField(default=0) diff --git a/contest/views.py b/contest/views.py index a5a45c427..867b999bd 100644 --- a/contest/views.py +++ b/contest/views.py @@ -392,6 +392,19 @@ def _cmp(x, y): return -1 +def get_the_time_format(seconds): + result = str(seconds % 60) + if seconds % 60 < 10: + result = "0" + result + result = str((seconds % 3600) / 60) + ":" + result + if (seconds % 3600) / 60 < 10: + result = "0" + result + result = str(seconds / 3600) + ":" + result + if seconds / 3600 < 10: + result = "0" + result + return result + + @check_user_contest_permission def contest_rank_page(request, contest_id): contest = Contest.objects.get(id=contest_id) @@ -410,17 +423,17 @@ def contest_rank_page(request, contest_id): try: status = submissions.get(problem=problem) result[i]["problems"].append({ - "first_achieved":status.first_achieved, + "first_achieved": status.first_achieved, "ac": status.ac, "failed_number": status.total_submission_number, - "ac_time": status.ac_time}) + "ac_time": get_the_time_format(status.ac_time)}) if status.ac: result[i]["problems"][-1]["failed_number"] -= 1 except ContestSubmission.DoesNotExist: result[i]["problems"].append({}) result[i]["total_ac"] = submissions.filter(ac=True).count() result[i]["username"] = User.objects.get(id=result[i]["user_id"]).username - result[i]["total_time"] = submissions.filter(ac=True).aggregate(total_time=Sum("total_time"))["total_time"] + result[i]["total_time"] = get_the_time_format(submissions.filter(ac=True).aggregate(total_time=Sum("total_time"))["total_time"]) result = sorted(result, cmp=_cmp, reverse=True) r.set("contest_rank_" + contest_id, json.dumps(list(result))) else: diff --git a/mq/scripts/info.py b/mq/scripts/info.py index 5e3691efd..c3a2a3678 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -71,7 +71,7 @@ def listen_task(self): contest_problem.total_accepted_number += 1 else: # 如果这个提交是错误的,就罚时20分钟 - contest_submission.total_time += 20 + contest_submission.total_time += 1200 contest_submission.total_submission_number += 1 contest_submission.save() contest_problem.save() @@ -79,13 +79,13 @@ def listen_task(self): # 第一次提交 is_ac = submission.result == result["accepted"] if is_ac: - total_time = int((submission.create_time - contest.start_time).total_seconds() / 60) + total_time = int((submission.create_time - contest.start_time).total_seconds()) # 增加题目总的ac数计数器 contest_problem.total_accepted_number += 1 contest_problem.save() else: # 没过罚时20分钟 - total_time = 20 + total_time = 1200 ContestSubmission.objects.create(user_id=submission.user_id, contest=contest, problem=contest_problem, ac=is_ac, total_time=total_time) diff --git a/template/src/oj/contest/contest_rank.html b/template/src/oj/contest/contest_rank.html index 62faf0b0f..11bc8d8f3 100644 --- a/template/src/oj/contest/contest_rank.html +++ b/template/src/oj/contest/contest_rank.html @@ -47,12 +47,10 @@

排名(

{{ forloop.counter }} {{ item.username }} {{ item.total_ac }} / {{ item.total_submit }}{% if item.total_time %}{{ item.total_time }} min{% else %}--{% endif %}{% if item.total_time %}{{ item.total_time }}{% else %}--{% endif %} - {% if problem.ac %} - {{ problem.ac_time }}min - {% endif %} + {% if problem.ac %}{{ problem.ac_time }}{% endif %} {% if problem.failed_number %} (-{{ problem.failed_number }}) {% endif %} From 728eb356253522d18bddc70b6bab9199b8aa3e9c Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 21:31:56 +0800 Subject: [PATCH 14/32] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0009_contestsubmission_first_achieved.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 contest/migrations/0009_contestsubmission_first_achieved.py diff --git a/contest/migrations/0009_contestsubmission_first_achieved.py b/contest/migrations/0009_contestsubmission_first_achieved.py new file mode 100644 index 000000000..ce9529ce2 --- /dev/null +++ b/contest/migrations/0009_contestsubmission_first_achieved.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('contest', '0008_auto_20150912_1912'), + ] + + operations = [ + migrations.AddField( + model_name='contestsubmission', + name='first_achieved', + field=models.BooleanField(default=False), + ), + ] From a2d2303466f6e22e71eeff6be3b14aca7978ebdc Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Sun, 13 Sep 2015 21:54:56 +0800 Subject: [PATCH 15/32] =?UTF-8?q?=E5=88=9A=E5=88=9A=E6=BC=8F=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E9=A1=B9~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mq/scripts/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mq/scripts/info.py b/mq/scripts/info.py index c3a2a3678..d36eb4965 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -62,7 +62,7 @@ def listen_task(self): # logger.debug(submission.create_time) # logger.debug((submission.create_time - contest.start_time).total_seconds()) # logger.debug(int((submission.create_time - contest.start_time).total_seconds() / 60)) - contest_submission.ac_time = int((submission.create_time - contest.start_time).total_seconds() / 60) + contest_submission.ac_time = int((submission.create_time - contest.start_time).total_seconds()) contest_submission.total_time += contest_submission.ac_time contest_submission.total_submission_number += 1 # 标记为已经通过 From 304d69c11404fb100eb2a8338d7d454f53694fc4 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Mon, 14 Sep 2015 10:19:04 +0800 Subject: [PATCH 16/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtypo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/src/oj/contest/contest_rank.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/src/oj/contest/contest_rank.html b/template/src/oj/contest/contest_rank.html index 11bc8d8f3..9490c3431 100644 --- a/template/src/oj/contest/contest_rank.html +++ b/template/src/oj/contest/contest_rank.html @@ -49,7 +49,7 @@

排名(

{{ item.total_ac }} / {{ item.total_submit }} {% if item.total_time %}{{ item.total_time }}{% else %}--{% endif %} + {% if problem.ac %}{{ problem.ac_time }}{% endif %} {% if problem.failed_number %} (-{{ problem.failed_number }}) From 624b6a3ce307d2410ace18343a7a4c6c5237b219 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Mon, 14 Sep 2015 12:15:48 +0800 Subject: [PATCH 17/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20avalon=20=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/build.js | 63 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/static/src/js/build.js b/static/src/js/build.js index 57e6321bc..971d7cef0 100644 --- a/static/src/js/build.js +++ b/static/src/js/build.js @@ -4,7 +4,7 @@ // 第三方脚本模块的别名,jquery比libs/jquery-1.11.1.min.js简洁明了; paths: { jquery: "empty:", - avalon: "lib/avalon/avalon", + avalon: "empty:", editor: "utils/editor", uploader: "utils/uploader", formValidation: "utils/formValidation", @@ -70,9 +70,68 @@ appDir: "../", dir: "../../release/", modules: [ - + { + name: "addProblem_0_pack" + }, { name: "addContest_1_pack" + }, + { + name: "problem_2_pack" + }, + { + name: "register_3_pack" + }, + { + name: "contestList_4_pack" + }, + { + name: "group_5_pack" + }, + { + name: "editProblem_6_pack" + }, + { + name: "announcement_7_pack" + }, + { + name: "monitor_8_pack" + }, + { + name: "groupDetail_9_pack" + }, + { + name: "admin_10_pack" + }, + { + name: "problem_11_pack" + }, + { + name: "submissionList_12_pack" + }, + { + name: "editProblem_13_pack" + }, + { + name: "joinGroupRequestList_14_pack" + }, + { + name: "changePassword_15_pack" + }, + { + name: "group_16_pack" + }, + { + name: "submissionList_17_pack" + }, + { + name: "login_18_pack" + }, + { + name: "contestPassword_19_pack" + }, + { + name: "userList_20_pack" } ], optimizeCss: "standard", From 93c03b541bc3bd997bee0762ba9aec869e5ced72 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Mon, 14 Sep 2015 13:15:53 +0800 Subject: [PATCH 18/32] =?UTF-8?q?=E5=88=9B=E5=BB=BA=20docker=20=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E7=9A=84=E6=97=B6=E5=80=99=E4=BD=BF=E7=94=A8=E9=98=BF?= =?UTF-8?q?=E9=87=8C=E4=BA=91=E7=9A=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge/Dockerfile | 2 ++ judge/sources.list | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 judge/sources.list diff --git a/judge/Dockerfile b/judge/Dockerfile index c2ca1b15e..7718e06fb 100644 --- a/judge/Dockerfile +++ b/judge/Dockerfile @@ -3,6 +3,8 @@ MAINTAINER virusdefender RUN mkdir /var/install/ WORKDIR /var/install/ ENV DEBIAN_FRONTEND noninteractive +RUN rm /etc/apt/sources.list +COPY sources.list /etc/apt/ RUN apt-get update RUN apt-get -y install software-properties-common python-software-properties RUN add-apt-repository -y ppa:webupd8team/java diff --git a/judge/sources.list b/judge/sources.list new file mode 100644 index 000000000..3f18a0f9c --- /dev/null +++ b/judge/sources.list @@ -0,0 +1,10 @@ +deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse \ No newline at end of file From 7febab2f1ac7daee85b6aa899d29fecd5e8070fd Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Mon, 14 Sep 2015 13:57:03 +0800 Subject: [PATCH 19/32] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E7=8E=AF=E5=A2=83=E4=BD=BF=E7=94=A8=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oj/local_settings.py | 6 +++++- oj/server_settings.py | 4 ++++ oj/settings.py | 6 +----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/oj/local_settings.py b/oj/local_settings.py index e61ec9c75..3b685e7a3 100644 --- a/oj/local_settings.py +++ b/oj/local_settings.py @@ -38,4 +38,8 @@ ALLOWED_HOSTS = [] -IMAGE_UPLOAD_DIR = os.path.join(BASE_DIR, 'static/src/upload_image/') \ No newline at end of file +IMAGE_UPLOAD_DIR = os.path.join(BASE_DIR, 'static/src/upload_image/') + +STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/src/")] + +TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/src/')] \ No newline at end of file diff --git a/oj/server_settings.py b/oj/server_settings.py index cc5ee829c..1702fa95b 100644 --- a/oj/server_settings.py +++ b/oj/server_settings.py @@ -43,3 +43,7 @@ ALLOWED_HOSTS = ['*'] IMAGE_UPLOAD_DIR = '/var/mnt/source/OnlineJudge/static/src/upload_image/' + +STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/")] + +TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/release/')] diff --git a/oj/settings.py b/oj/settings.py index 097a4c217..bc4006921 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -32,8 +32,6 @@ SECRET_KEY = 'hzfp^8mbgapc&x%$#xv)0=t8s7_ilingw(q3!@h&2fty6v6fxz' - - # Application definition INSTALLED_APPS = ( @@ -76,7 +74,7 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'template/src')], + 'DIRS': TEMPLATE_DIRS, 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -111,8 +109,6 @@ STATIC_URL = '/static/' -STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/src/"),) - AUTH_USER_MODEL = 'account.User' LOGGING = { From c648e0008f87cbfd4642425336e974ac44b373c1 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Mon, 14 Sep 2015 18:20:36 +0800 Subject: [PATCH 20/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=96=B9=E4=BE=BF=E5=8C=BA=E5=88=86=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E7=9A=84=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- Dockerfile | 2 +- judge/judger/settings.py | 7 +++---- oj/local_settings.py | 20 +++++++------------- oj/server_settings.py | 26 ++++++++++---------------- oj/settings.py | 10 ++++++++-- utils/views.py | 4 ++-- 7 files changed, 33 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 31d22157d..e08736161 100644 --- a/.gitignore +++ b/.gitignore @@ -62,4 +62,5 @@ static/src/upload_image/* build.txt tmp/ test_case/ -release/ \ No newline at end of file +release/ +upload/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2e10830ac..113ed5885 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:2.7 ENV PYTHONBUFFERED 1 -RUN mkdir -p /code/log /code/test_case +RUN mkdir -p /code/log /code/test_case /code/upload WORKDIR /code ADD requirements.txt /code/ RUN pip install -r requirements.txt diff --git a/judge/judger/settings.py b/judge/judger/settings.py index 1f15b96bc..224cf5ddd 100644 --- a/judge/judger/settings.py +++ b/judge/judger/settings.py @@ -1,4 +1,5 @@ # coding=utf-8 +import os # 单个判题端最多同时运行的程序个数,因为判题端会同时运行多组测试数据,比如一共有5组测试数据 # 如果MAX_RUNNING_NUMBER大于等于5,那么这5组数据就会同时进行评测,然后返回结果。 # 如果MAX_RUNNING_NUMBER小于5,为3,那么就会同时运行前三组测试数据,然后再运行后两组数据 @@ -14,12 +15,10 @@ # judger工作目录 judger_workspace = "/var/judger/" - -# 这个是在docker 中访问数据库 ip 不一定和web服务器还有celery的一样 submission_db = { - "host": "192.168.42.1", + "host": os.environ.get("MYSQL_PORT_3306_TCP_ADDR", "127.0.0.1"), "port": 3306, "db": "oj_submission", "user": "root", - "password": "mypwd" + "password": os.environ.get("MYSQL_ENV_MYSQL_ROOT_PASSWORD", "root") } diff --git a/oj/local_settings.py b/oj/local_settings.py index 3b685e7a3..074b1b010 100644 --- a/oj/local_settings.py +++ b/oj/local_settings.py @@ -3,10 +3,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -# 下面是需要自己修改的 -LOG_PATH = "log/" - # 注意这是web 服务器访问的地址,判题端访问的地址不一定一样,因为可能不在一台机器上 DATABASES = { 'default': { @@ -17,11 +13,11 @@ 'submission': { 'NAME': 'oj_submission', 'ENGINE': 'django.db.backends.mysql', - 'HOST': "121.42.32.129", + 'CONN_MAX_AGE': 0.1, + 'HOST': "127.0.0.1", 'PORT': 3306, 'USER': 'root', - 'PASSWORD': 'mypwd', - 'CONN_MAX_AGE': 0.1, + 'PASSWORD': 'root', } } @@ -33,13 +29,11 @@ DEBUG = True -# 同理 这是 web 服务器的上传路径 -TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/') - ALLOWED_HOSTS = [] -IMAGE_UPLOAD_DIR = os.path.join(BASE_DIR, 'static/src/upload_image/') - -STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/src/")] +# 在 debug 关闭的情况下,静态文件不是有 django runserver 来处理的,应该由 nginx 返回 +# 在 debug 开启的情况下,django 会在下面两个文件夹中寻找对应的静态文件。 +STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/src/"), BASE_DIR] +# 模板文件夹 TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/src/')] \ No newline at end of file diff --git a/oj/server_settings.py b/oj/server_settings.py index 1702fa95b..77ca1fd04 100644 --- a/oj/server_settings.py +++ b/oj/server_settings.py @@ -3,47 +3,41 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -# 下面是需要自己修改的 -LOG_PATH = "/var/log/oj/" - # 注意这是web 服务器访问的地址,判题端访问的地址不一定一样,因为可能不在一台机器上 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': "oj", 'CONN_MAX_AGE': 0.1, - 'HOST': '127.0.0.1', + 'HOST': os.environ.get("MYSQL_PORT_3306_TCP_ADDR", "127.0.0.1"), 'PORT': 3306, 'USER': 'root', - 'PASSWORD': 'mypwd' + 'PASSWORD': os.environ.get("MYSQL_ENV_MYSQL_ROOT_PASSWORD", "root") }, 'submission': { 'NAME': 'oj_submission', 'ENGINE': 'django.db.backends.mysql', 'CONN_MAX_AGE': 0.1, - 'HOST': "127.0.0.1", + 'HOST': os.environ.get("MYSQL_PORT_3306_TCP_ADDR", "127.0.0.1"), 'PORT': 3306, 'USER': 'root', - 'PASSWORD': 'mypwd' + 'PASSWORD': os.environ.get("MYSQL_ENV_MYSQL_ROOT_PASSWORD", "root") } } REDIS_CACHE = { - "host": "127.0.0.1", + "host": os.environ.get("REDIS_PORT_6379_TCP_ADDR", "127.0.0.1"), "port": 6379, "db": 1 } -DEBUG = True - -# 同理 这是 web 服务器的上传路径 -TEST_CASE_DIR = '/root/test_case/' +DEBUG = False ALLOWED_HOSTS = ['*'] -IMAGE_UPLOAD_DIR = '/var/mnt/source/OnlineJudge/static/src/upload_image/' - -STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/")] +# 在 debug 关闭的情况下,静态文件不是有 django runserver 来处理的,应该由 nginx 返回 +# 在 debug 开启的情况下,django 会在下面两个文件夹中寻找对应的静态文件。 +STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/"), os.path.join(BASE_DIR, "static/release/")] +# 模板文件夹 TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/release/')] diff --git a/oj/settings.py b/oj/settings.py index bc4006921..7e4791941 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -89,7 +89,6 @@ WSGI_APPLICATION = 'oj.wsgi.application' - # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ @@ -111,6 +110,9 @@ AUTH_USER_MODEL = 'account.User' +LOG_PATH = "log/" + + LOGGING = { 'version': 1, 'disable_existing_loggers': True, @@ -162,4 +164,8 @@ 'TEST_REQUEST_DEFAULT_FORMAT': 'json' } -DATABASE_ROUTERS = ['oj.db_router.DBRouter'] \ No newline at end of file +DATABASE_ROUTERS = ['oj.db_router.DBRouter'] + +TEST_CASE_DIR = os.path.join(BASE_DIR, 'test_case/') + +IMAGE_UPLOAD_DIR = os.path.join(BASE_DIR, 'upload/') \ No newline at end of file diff --git a/utils/views.py b/utils/views.py index 87beeb4f3..7e2375e22 100644 --- a/utils/views.py +++ b/utils/views.py @@ -26,8 +26,8 @@ def post(self, request): return Response(data={ "success": True, "msg": "上传错误", - "file_path": "/static/upload_image/" + image_name}) + "file_path": "/static/upload/" + image_name}) return Response(data={ "success": True, "msg": "", - "file_path": "/static/upload_image/" + image_name}) + "file_path": "/static/upload/" + image_name}) From 3e583611e316b394a0f45eff961795d46888e8a6 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Mon, 14 Sep 2015 19:23:53 +0800 Subject: [PATCH 21/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98,?= =?UTF-8?q?=E6=AF=94=E8=B5=9B=E5=88=97=E8=A1=A8=E7=BC=96=E8=BE=91=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8=E6=8F=90=E4=BA=A4?= =?UTF-8?q?,=E5=86=99=E9=94=99=E5=8F=98=E9=87=8F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/app/admin/contest/contestList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/src/js/app/admin/contest/contestList.js b/static/src/js/app/admin/contest/contestList.js index 315023cef..684ea89cf 100644 --- a/static/src/js/app/admin/contest/contestList.js +++ b/static/src/js/app/admin/contest/contestList.js @@ -28,7 +28,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", ajaxData.groups = selectedGroups; } else { - if (vm.password) { + if (vm.editPassword) { ajaxData.password = vm.editPassword; ajaxData.contest_type = 2; } From b4bdf7a669c6a4abc8f64c3f018db2de0e73a918 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Mon, 14 Sep 2015 20:51:48 +0800 Subject: [PATCH 22/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9rank=20=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84bug(=E5=AF=B9=E4=BA=8E=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9C=89=E6=95=88=E6=97=B6=E9=97=B4=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=E8=BD=AC=E6=8D=A2=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5),=E6=B7=BB=E5=8A=A0mq=E5=AF=B9first=5Fachieved?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/views.py | 2 ++ mq/scripts/info.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contest/views.py b/contest/views.py index 867b999bd..28bb7212a 100644 --- a/contest/views.py +++ b/contest/views.py @@ -393,6 +393,8 @@ def _cmp(x, y): def get_the_time_format(seconds): + if not seconds: + return "" result = str(seconds % 60) if seconds % 60 < 10: result = "0" + result diff --git a/mq/scripts/info.py b/mq/scripts/info.py index d36eb4965..84040b877 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -66,6 +66,8 @@ def listen_task(self): contest_submission.total_time += contest_submission.ac_time contest_submission.total_submission_number += 1 # 标记为已经通过 + if contest_problem.total_accepted_number == 0: + contest_submission.first_achieved = True contest_submission.ac = True # contest problem ac 计数器加1 contest_problem.total_accepted_number += 1 @@ -81,13 +83,16 @@ def listen_task(self): if is_ac: total_time = int((submission.create_time - contest.start_time).total_seconds()) # 增加题目总的ac数计数器 + first_achieved = False + if contest_problem.total_accepted_number == 0: + first_achieved = True contest_problem.total_accepted_number += 1 contest_problem.save() else: # 没过罚时20分钟 total_time = 1200 ContestSubmission.objects.create(user_id=submission.user_id, contest=contest, problem=contest_problem, - ac=is_ac, total_time=total_time) + ac=is_ac, total_time=total_time, first_achieved=first_achieved) logger.debug("Start message queue") From 856ad6d378a9036cb28af91791bc22cc39c356e5 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Mon, 14 Sep 2015 21:21:56 +0800 Subject: [PATCH 23/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dac=5Ftime=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E6=B7=BB=E5=8A=A0first=5Fachieved?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mq/scripts/info.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mq/scripts/info.py b/mq/scripts/info.py index 84040b877..01ef6b2df 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -80,10 +80,12 @@ def listen_task(self): except ContestSubmission.DoesNotExist: # 第一次提交 is_ac = submission.result == result["accepted"] + first_achieved = False + ac_time = 0 if is_ac: + ac_time = int((submission.create_time - contest.start_time).total_seconds()) total_time = int((submission.create_time - contest.start_time).total_seconds()) # 增加题目总的ac数计数器 - first_achieved = False if contest_problem.total_accepted_number == 0: first_achieved = True contest_problem.total_accepted_number += 1 @@ -92,7 +94,8 @@ def listen_task(self): # 没过罚时20分钟 total_time = 1200 ContestSubmission.objects.create(user_id=submission.user_id, contest=contest, problem=contest_problem, - ac=is_ac, total_time=total_time, first_achieved=first_achieved) + ac=is_ac, total_time=total_time, first_achieved=first_achieved, + ac_time=ac_time) logger.debug("Start message queue") From 5066a393123ee4ac6e26ba67ba10771f58fe8664 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Tue, 15 Sep 2015 09:36:24 +0800 Subject: [PATCH 24/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=89=93=E5=8C=85=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/build.js | 5 ++++- tools/release_static.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/static/src/js/build.js b/static/src/js/build.js index 971d7cef0..3acf938c9 100644 --- a/static/src/js/build.js +++ b/static/src/js/build.js @@ -70,7 +70,10 @@ appDir: "../", dir: "../../release/", modules: [ - { + { + name: "bootstrap", + }, + { name: "addProblem_0_pack" }, { diff --git a/tools/release_static.py b/tools/release_static.py index ffee461b0..0a51b8a79 100644 --- a/tools/release_static.py +++ b/tools/release_static.py @@ -9,9 +9,11 @@ static_src_path = "static/src/" static_release_path = "static/release/" - -# 删除模板的 release 文件夹 -shutil.rmtree(template_release_path) +try: + # 删除模板的 release 文件夹 + shutil.rmtree(template_release_path) +except Exception: + pass # 复制一份模板文件夹到 release shutil.copytree(template_src_path, template_release_path) From de14553e438936716056f360efc9f7f0459b2eaf Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Tue, 15 Sep 2015 10:19:44 +0800 Subject: [PATCH 25/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A1=B5=E9=9D=A2=E7=9A=84js=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=88=A4=E6=96=AD=E8=AF=AD=E8=A8=80=20?= =?UTF-8?q?=E6=9B=B4=E5=8A=A0=E5=AE=BD=E6=B3=9B=EF=BC=8C=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20=E5=AF=B9=E4=BA=8E=20=5F=5Fint64=E5=92=8C%I64d?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/app/oj/problem/problem.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/static/src/js/app/oj/problem/problem.js b/static/src/js/app/oj/problem/problem.js index d855d1133..1ce0bfd69 100644 --- a/static/src/js/app/oj/problem/problem.js +++ b/static/src/js/app/oj/problem/problem.js @@ -120,10 +120,7 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"], if (code.indexOf("using namespace std") > -1) { return "2"; } - //c - if (code.indexOf("printf") > -1) { - return "1"; - } + //java if (code.indexOf("public class Main")) { return "3"; @@ -146,6 +143,19 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"], } } + if (language < 3) { + if (code.indexOf("__int64") > -1) { + if (!confirm("您是否在尝试使用'__int64'类型? 这不是 c/c++ 标准并将引发编译错误可以使用 'long long' 代替(详见关于->帮助),是否仍然提交?")) { + return; + } + } + if (code.indexOf("__int64") > -1) { + if (!confirm("您是否在尝试用'%I64d'做long long类型的I/O? 这不是 c/c++ 标准并将引发编译错误可以使用 '%lld' 代替(详见关于->帮助),是否仍然提交?")) { + return; + } + } + } + if (location.href.indexOf("contest") > -1) { var problemId = location.pathname.split("/")[4]; var contestId = location.pathname.split("/")[2]; From 0f6c822affdc805cfc97750868c67b031863beac Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Tue, 15 Sep 2015 13:13:39 +0800 Subject: [PATCH 26/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=88=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E6=B2=A1=E7=9C=8B=E5=A5=BD=EF=BC=89=20=E8=BD=BB=E5=BE=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2js=E5=AF=B9=E8=AF=AD=E8=A8=80=E5=B0=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E6=8F=90=E7=A4=BA=E5=8A=9F=E8=83=BD=E3=80=82?= =?UTF-8?q?=20=E5=86=8D=E6=AC=A1=E6=B7=BB=E5=8A=A0C=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=20=E6=B7=BB=E5=8A=A0c++=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=9D=A1=E4=BB=B6=20=20cstdio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/app/oj/problem/problem.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/static/src/js/app/oj/problem/problem.js b/static/src/js/app/oj/problem/problem.js index 1ce0bfd69..4817309d9 100644 --- a/static/src/js/app/oj/problem/problem.js +++ b/static/src/js/app/oj/problem/problem.js @@ -117,10 +117,13 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"], function guessLanguage(code) { //cpp - if (code.indexOf("using namespace std") > -1) { + if (code.indexOf("using namespace std") > -1||code.indexOf("") > -1) { return "2"; } - + if (code.indexOf("printf")) + { + return "1"; + } //java if (code.indexOf("public class Main")) { return "3"; @@ -145,12 +148,12 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"], if (language < 3) { if (code.indexOf("__int64") > -1) { - if (!confirm("您是否在尝试使用'__int64'类型? 这不是 c/c++ 标准并将引发编译错误可以使用 'long long' 代替(详见关于->帮助),是否仍然提交?")) { + if (!confirm("您是否在尝试使用'__int64'类型? 这不是 c/c++ 标准并将引发编译错误可以使用 'long long' 代替(详见 关于->帮助),是否仍然提交?")) { return; } } - if (code.indexOf("__int64") > -1) { - if (!confirm("您是否在尝试用'%I64d'做long long类型的I/O? 这不是 c/c++ 标准并将引发编译错误可以使用 '%lld' 代替(详见关于->帮助),是否仍然提交?")) { + if (code.indexOf("%I64d") > -1) { + if (!confirm("您是否在尝试将'%I64d'用于long long类型的I/O? 这不被支持,并可能会导致程序输出异常,可以使用 '%lld' 代替(详见 关于->帮助),是否仍然提交?")) { return; } } From a14761ede1bbe8ab71b6db50110abec3b582f35b Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Tue, 15 Sep 2015 13:20:18 +0800 Subject: [PATCH 27/32] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=B2=A1=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=A0=87=E7=AD=BE=EF=BC=8C=E5=9B=A0=E4=B8=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E6=8E=92=E5=90=8D=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E7=94=A8=E4=B8=8D=E7=9D=80=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A0=87=E7=AD=BE=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/src/oj/contest/contest_rank.html | 1 - 1 file changed, 1 deletion(-) diff --git a/template/src/oj/contest/contest_rank.html b/template/src/oj/contest/contest_rank.html index 45f2103a1..aefb1990e 100644 --- a/template/src/oj/contest/contest_rank.html +++ b/template/src/oj/contest/contest_rank.html @@ -1,6 +1,5 @@ {% extends "oj_base.html" %} {% block body %} - {% load submission %}
From 0bbd4a1a068aad3bc3e3f680166e7ba1bff05376 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Tue, 15 Sep 2015 14:16:36 +0800 Subject: [PATCH 30/32] =?UTF-8?q?=E4=B8=BA=E8=B6=85=E7=BA=A7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=B7=BB=E5=8A=A0=E5=89=8D=E5=8F=B0=E5=88=B0?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=9A=84=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/src/oj_base.html | 45 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/template/src/oj_base.html b/template/src/oj_base.html index b39897657..f90052cc4 100644 --- a/template/src/oj_base.html +++ b/template/src/oj_base.html @@ -50,28 +50,31 @@
  • 关于
  • {% if request.user.is_authenticated %} - + {% else %} - + {% endif %}
    From 42087b3854e52ffae059dd9c6d71b09033158e06 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Tue, 15 Sep 2015 15:07:08 +0800 Subject: [PATCH 31/32] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=88=B0=E5=89=8D=E5=8F=B0=E7=9A=84=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/src/admin/admin.html | 6 +-- template/src/utils/help.html | 73 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/template/src/admin/admin.html b/template/src/admin/admin.html index c7577bafc..459a69fcd 100644 --- a/template/src/admin/admin.html +++ b/template/src/admin/admin.html @@ -31,9 +31,9 @@