feat: joj3-check-env ignore submitter
All checks were successful
build / trigger-build-image (push) Successful in 24s
All checks were successful
build / trigger-build-image (push) Successful in 24s
This commit is contained in:
parent
69e097e04b
commit
332e522051
|
|
@ -501,6 +501,7 @@ def joj3_check_env(
|
|||
"Example: --penalty-config 24=0.75,48=0.5"
|
||||
),
|
||||
),
|
||||
ignore_submitter: bool = Option(False, help="ignore submitter when checking"),
|
||||
) -> None:
|
||||
app.pretty_exceptions_enable = False
|
||||
set_settings(Settings(_env_file=env_path))
|
||||
|
|
@ -519,7 +520,7 @@ def joj3_check_env(
|
|||
penalty_config,
|
||||
)
|
||||
count_msg, count_failed = tea.pot.joj3_check_submission_count(
|
||||
env, grading_repo_name, group_config, scoreboard_filename
|
||||
env, grading_repo_name, group_config, scoreboard_filename, ignore_submitter
|
||||
)
|
||||
echo(
|
||||
json.dumps(
|
||||
|
|
|
|||
|
|
@ -359,7 +359,9 @@ class Teapot:
|
|||
grading_repo_name: str,
|
||||
group_config: str,
|
||||
scoreboard_filename: str,
|
||||
ignore_submitter: bool,
|
||||
) -> Tuple[str, bool]:
|
||||
submitter = env.github_actor
|
||||
submitter_repo_name = env.github_repository.split("/")[-1]
|
||||
repo: Repo = self.git.get_repo(grading_repo_name)
|
||||
now = datetime.now(timezone.utc)
|
||||
|
|
@ -402,10 +404,11 @@ class Teapot:
|
|||
d = match.groupdict()
|
||||
if (
|
||||
env.joj3_conf_name != d["exercise_name"]
|
||||
or env.github_actor != d["submitter"]
|
||||
or submitter_repo_name != d["submitter_repo_name"]
|
||||
):
|
||||
continue
|
||||
if not ignore_submitter and submitter != d["submitter"]:
|
||||
continue
|
||||
groups_line = next((l for l in lines if l.startswith("groups: ")), None)
|
||||
commit_groups = (
|
||||
groups_line[len("groups: ") :].split(",") if groups_line else []
|
||||
|
|
@ -432,7 +435,7 @@ class Teapot:
|
|||
continue
|
||||
submit_count += 1
|
||||
logger.info(
|
||||
f"submitter {env.github_actor} is submitting for the {submit_count + 1} time, "
|
||||
f"submitter {submitter} is submitting for the {submit_count + 1} time, "
|
||||
f"{min(0, max_count - submit_count - 1)} time(s) remaining, "
|
||||
f"group={name}, "
|
||||
f"time period={time_period} hour(s), "
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user