mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
Accept Merge Request #270 dev -> master : (dev -> master)
Merge Request: dev -> master Created By: @virusdefender Accepted By: @virusdefender URL: https://coding.net/u/virusdefender/p/qduoj/git/merge/270
This commit is contained in:
commit
3980d26b26
@ -120,6 +120,9 @@ class ContestRank(models.Model):
|
||||
# key 是比赛题目的id
|
||||
submission_info = JSONField(default={})
|
||||
|
||||
class Meta:
|
||||
db_table = "contest_rank"
|
||||
|
||||
def update_rank(self, submission):
|
||||
if not submission.contest_id or submission.contest_id != self.contest_id:
|
||||
raise ValueError("Error submission type")
|
||||
|
||||
@ -37,5 +37,6 @@ class JoinGroupRequest(models.Model):
|
||||
# 是否处理
|
||||
status = models.BooleanField(default=False)
|
||||
accepted = models.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
db_table = "join_group_request"
|
||||
|
||||
@ -39,20 +39,21 @@ class MessageQueue(object):
|
||||
logger.warning("Submission user does not exist, submission_id: " + submission_id)
|
||||
continue
|
||||
|
||||
if submission.result == result["accepted"] and not submission.contest_id:
|
||||
if not submission.contest_id:
|
||||
# 更新普通题目的 ac 计数器
|
||||
try:
|
||||
problem = Problem.objects.get(id=submission.problem_id)
|
||||
problem.total_accepted_number += 1
|
||||
problem.save()
|
||||
except Problem.DoesNotExist:
|
||||
logger.warning("Submission problem does not exist, submission_id: " + submission_id)
|
||||
continue
|
||||
if submission.result == result["accepted"]:
|
||||
try:
|
||||
problem = Problem.objects.get(id=submission.problem_id)
|
||||
problem.total_accepted_number += 1
|
||||
problem.save()
|
||||
except Problem.DoesNotExist:
|
||||
logger.warning("Submission problem does not exist, submission_id: " + submission_id)
|
||||
continue
|
||||
|
||||
problems_status = user.problems_status
|
||||
problems_status["problems"][str(problem.id)] = 1
|
||||
user.problems_status = problems_status
|
||||
user.save()
|
||||
problems_status = user.problems_status
|
||||
problems_status["problems"][str(problem.id)] = 1
|
||||
user.problems_status = problems_status
|
||||
user.save()
|
||||
|
||||
# 普通题目的话,到这里就结束了
|
||||
continue
|
||||
|
||||
@ -45,6 +45,7 @@ class AbstractProblem(models.Model):
|
||||
total_accepted_number = models.IntegerField(default=0)
|
||||
|
||||
class Meta:
|
||||
db_table = "problem"
|
||||
abstract = True
|
||||
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class XssHtml(HTMLParser):
|
||||
'p', 'div', 'em', 'span', 'h1', 'h2', 'h3', 'h4',
|
||||
'h5', 'h6', 'blockquote', 'ul', 'ol', 'tr', 'th', 'td',
|
||||
'hr', 'li', 'u', 'embed', 's', 'table', 'thead', 'tbody',
|
||||
'caption', 'small', 'q', 'sup', 'sub']
|
||||
'caption', 'small', 'q', 'sup', 'sub', 'font']
|
||||
common_attrs = ["style", "class", "name"]
|
||||
nonend_tags = ["img", "hr", "br", "embed"]
|
||||
tags_own_attrs = {
|
||||
@ -46,6 +46,7 @@ class XssHtml(HTMLParser):
|
||||
"a": ["href", "target", "rel", "title"],
|
||||
"embed": ["src", "width", "height", "type", "allowfullscreen", "loop", "play", "wmode", "menu"],
|
||||
"table": ["border", "cellpadding", "cellspacing"],
|
||||
"font": ["color"]
|
||||
}
|
||||
|
||||
def __init__(self, allows=[]):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user