feat: support auto scoreboard name
This commit is contained in:
parent
2bcf4f8c60
commit
29952a9d2d
|
@ -1,3 +1,4 @@
|
||||||
|
import re
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -237,3 +238,11 @@ class Config(BaseModel):
|
||||||
max_total_score: Optional[int] = Field(
|
max_total_score: Optional[int] = Field(
|
||||||
None, validation_alias=AliasChoices("max-total-score", "max_total_score")
|
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
|
||||||
|
|
|
@ -42,6 +42,8 @@ def get_teapot_post_stage(
|
||||||
repo_conf.issue.label.name,
|
repo_conf.issue.label.name,
|
||||||
"--issue-label-color",
|
"--issue-label-color",
|
||||||
repo_conf.issue.label.color,
|
repo_conf.issue.label.color,
|
||||||
|
"--scoreboard-filename",
|
||||||
|
task_conf.scoreboard,
|
||||||
]
|
]
|
||||||
if not repo_conf.issue.show_submitter:
|
if not repo_conf.issue.show_submitter:
|
||||||
args.append("--no-submitter-in-issue-title")
|
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"),
|
str(TEAPOT_CONFIG_ROOT / "teapot.env"),
|
||||||
"--grading-repo-name",
|
"--grading-repo-name",
|
||||||
repo_conf.grading_repo_name,
|
repo_conf.grading_repo_name,
|
||||||
|
"--scoreboard-filename",
|
||||||
|
task_conf.scoreboard,
|
||||||
]
|
]
|
||||||
if repo_conf.groups.name:
|
if repo_conf.groups.name:
|
||||||
group_str = lambda groups: ",".join(
|
group_str = lambda groups: ",".join(
|
||||||
|
|
|
@ -75,6 +75,8 @@
|
||||||
"/home/tt/.config/teapot/teapot.env",
|
"/home/tt/.config/teapot/teapot.env",
|
||||||
"--grading-repo-name",
|
"--grading-repo-name",
|
||||||
"ece280-joj",
|
"ece280-joj",
|
||||||
|
"--scoreboard-filename",
|
||||||
|
"scoreboard-hw7.csv",
|
||||||
"--group-config",
|
"--group-config",
|
||||||
"Manuel=500:24,Boming=501:48,Nuvole=502:72",
|
"Manuel=500:24,Boming=501:48,Nuvole=502:72",
|
||||||
"--end-time",
|
"--end-time",
|
||||||
|
@ -815,6 +817,8 @@
|
||||||
"Kind/Testing",
|
"Kind/Testing",
|
||||||
"--issue-label-color",
|
"--issue-label-color",
|
||||||
"#795548",
|
"#795548",
|
||||||
|
"--scoreboard-filename",
|
||||||
|
"scoreboard-hw7.csv",
|
||||||
"--end-time",
|
"--end-time",
|
||||||
"2024-12-30T23:59:59",
|
"2024-12-30T23:59:59",
|
||||||
"--penalty-config",
|
"--penalty-config",
|
||||||
|
|
|
@ -4,6 +4,7 @@ task.name = "hw7 ex2" # task name
|
||||||
max-total-score = 10245871
|
max-total-score = 10245871
|
||||||
time.end = 2024-12-30 23:59:59+08:00
|
time.end = 2024-12-30 23:59:59+08:00
|
||||||
release.begin-time = 2024-12-29 23:59:59+08:00
|
release.begin-time = 2024-12-29 23:59:59+08:00
|
||||||
|
scoreboard = "auto"
|
||||||
|
|
||||||
[penalties]
|
[penalties]
|
||||||
hours = [ 24, 48, 72 ]
|
hours = [ 24, 48, 72 ]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user