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