problem改用_id作为搜索用主键;submission更加statistic_info字段

This commit is contained in:
zemal
2017-07-04 20:59:25 +08:00
parent 91eb7b5bb6
commit 62274224a9
6 changed files with 46 additions and 10 deletions

View File

@@ -101,12 +101,14 @@ class JudgeDispatcher(object):
if resp["err"]:
self.submission_obj.result = JudgeStatus.COMPILE_ERROR
else:
# 用时和内存占用保存为多个测试点中最长的那个
self.submission_obj.statistic_info["time_cost"] = max([x["cpu_time"] for x in resp["data"]])
self.submission_obj.statistic_info["memory_cost"] = max([x["memory"] for x in resp["data"]])
error_test_case = list(filter(lambda case: case["result"] != 0, resp["data"]))
# 多个测试点全部正确AC否则 ACM模式下取第一个错误的测试点状态, OI模式对应为部分正确
if not error_test_case:
self.submission_obj.result = JudgeStatus.ACCEPTED
# AC 用时保存为多个测试点中最长的那个
self.submission_obj.accepted_time = max([x["cpu_time"] for x in resp["data"]])
elif self.problem_obj.rule_type == ProblemRuleType.ACM:
self.submission_obj.result = error_test_case[0]["result"]
else: