修复 ACM 类型题目导入后,无法显示测试用例信息的问题

This commit is contained in:
virusdefender 2019-01-05 13:13:30 +08:00
parent efddadb898
commit 2dc1d0cbce

View File

@ -154,8 +154,9 @@ class ExportProblemSerializer(serializers.ModelSerializer):
return self._html_format_value(obj.hint) return self._html_format_value(obj.hint)
def get_test_case_score(self, obj): def get_test_case_score(self, obj):
return [{"score": item["score"], "input_name": item["input_name"], "output_name": item["output_name"]} return [{"score": item["score"] if obj.rule_type == ProblemRuleType.OI else 100,
for item in obj.test_case_score] if obj.rule_type == ProblemRuleType.OI else None "input_name": item["input_name"], "output_name": item["output_name"]}
for item in obj.test_case_score]
def get_spj(self, obj): def get_spj(self, obj):
return {"code": obj.spj_code, return {"code": obj.spj_code,