From 2b0dc41b18397f0c275dcd719d55cfb867d28e85 Mon Sep 17 00:00:00 2001 From: Dup4 Date: Thu, 9 Nov 2023 21:30:19 +0800 Subject: [PATCH] feat: support update contest for DOMjudge v3 Signed-off-by: Dup4 --- xcpcio_board_spider/spider/domjudge/v3/domjudge.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xcpcio_board_spider/spider/domjudge/v3/domjudge.py b/xcpcio_board_spider/spider/domjudge/v3/domjudge.py index ad86f04..8496587 100644 --- a/xcpcio_board_spider/spider/domjudge/v3/domjudge.py +++ b/xcpcio_board_spider/spider/domjudge/v3/domjudge.py @@ -1,6 +1,6 @@ import math -from xcpcio_board_spider.type import Contest, Team, Teams, Submission, Submissions, constants +from xcpcio_board_spider.type import Contest, Team, Teams, Submission, Submissions, constants, Color from domjudge_utility import Dump, DumpConfig @@ -136,3 +136,12 @@ def parse_runs(self): self.runs.append(submission) return self + + def update_contest(self): + self.contest.problem_quantity = len(self.dump.problems) + self.contest.fill_problem_id() + + self.contest.balloon_color = [] + for p in self.dump.problems: + self.contest.balloon_color.append( + Color(background_color=p["rgb"], color="#000"))