feat: support auto scoreboard name
All checks were successful
build / build (push) Successful in 1m56s
build / trigger-build-image (push) Successful in 9s

This commit is contained in:
张泊明518370910136 2025-06-20 04:01:45 -04:00
parent 2bcf4f8c60
commit 29952a9d2d
GPG Key ID: D47306D7062CDA9D
4 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import re
from datetime import datetime, timezone
from enum import Enum
from pathlib import Path
@ -237,3 +238,11 @@ class Config(BaseModel):
max_total_score: Optional[int] = Field(
None, validation_alias=AliasChoices("max-total-score", "max_total_score")
)
scoreboard: str = "scoreboard.csv"
@model_validator(mode="after")
def set_scoreboard(self) -> "Config":
if self.scoreboard == "auto":
suffix = re.split(r"[-_/\s]+", self.task.name)[0]
self.scoreboard = f"scoreboard-{suffix}.csv"
return self

View File

@ -42,6 +42,8 @@ def get_teapot_post_stage(
repo_conf.issue.label.name,
"--issue-label-color",
repo_conf.issue.label.color,
"--scoreboard-filename",
task_conf.scoreboard,
]
if not repo_conf.issue.show_submitter:
args.append("--no-submitter-in-issue-title")
@ -119,6 +121,8 @@ def get_teapot_check_args(repo_conf: repo.Config, task_conf: task.Config) -> Lis
str(TEAPOT_CONFIG_ROOT / "teapot.env"),
"--grading-repo-name",
repo_conf.grading_repo_name,
"--scoreboard-filename",
task_conf.scoreboard,
]
if repo_conf.groups.name:
group_str = lambda groups: ",".join(

View File

@ -75,6 +75,8 @@
"/home/tt/.config/teapot/teapot.env",
"--grading-repo-name",
"ece280-joj",
"--scoreboard-filename",
"scoreboard-hw7.csv",
"--group-config",
"Manuel=500:24,Boming=501:48,Nuvole=502:72",
"--end-time",
@ -815,6 +817,8 @@
"Kind/Testing",
"--issue-label-color",
"#795548",
"--scoreboard-filename",
"scoreboard-hw7.csv",
"--end-time",
"2024-12-30T23:59:59",
"--penalty-config",

View File

@ -4,6 +4,7 @@ task.name = "hw7 ex2" # task name
max-total-score = 10245871
time.end = 2024-12-30 23:59:59+08:00
release.begin-time = 2024-12-29 23:59:59+08:00
scoreboard = "auto"
[penalties]
hours = [ 24, 48, 72 ]