feat: update joj3 format

This commit is contained in:
张泊明518370910136 2024-09-30 05:31:13 -04:00
parent 98e4400e32
commit b128625bce
GPG Key ID: CA088E6D9284F870
2 changed files with 15 additions and 9 deletions

View File

@ -242,9 +242,8 @@ def joj3_scoreboard(
submitter, submitter,
os.path.join(repo_path, scoreboard_file_name), os.path.join(repo_path, scoreboard_file_name),
) )
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
tea.pot.git.add_commit_and_push( tea.pot.git.add_commit_and_push(
repo_name, [scoreboard_file_name], f"test: JOJ3-dev testing at {now}" repo_name, [scoreboard_file_name], f"joj3: update scoreboard by {submitter}"
) )
@ -293,9 +292,10 @@ def joj3_failed_table(
submitter_repo_link, submitter_repo_link,
os.path.join(repo_path, failed_table_file_name), os.path.join(repo_path, failed_table_file_name),
) )
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
tea.pot.git.add_commit_and_push( tea.pot.git.add_commit_and_push(
repo_name, [failed_table_file_name], f"test: JOJ3-dev testing at {now}" repo_name,
[failed_table_file_name],
f"joj3: update failed table by {submitter_repo_name}",
) )

View File

@ -172,17 +172,23 @@ def generate_title_and_comment(
stages: List[Dict[str, Any]] = json.load(json_file) stages: List[Dict[str, Any]] = json.load(json_file)
total_score = 0 total_score = 0
comment = f"[Gitea Actions]({action_link})\n" comment = f"Generated by [Gitea Actions]({action_link})\n"
for stage in stages: for stage in stages:
comment += f"## {stage['name']}\n" comment += f"## {stage['name']}\n"
single_case = len(stage["results"]) == 1
for i, result in enumerate(stage["results"]): for i, result in enumerate(stage["results"]):
comment += f"### case {i}\n" comment += "### "
comment += f"score: {result['score']}\n" if not single_case:
comment += f"comment: {result['comment']}\n" comment += f"Case {i} - Score: {result['score']}"
else:
comment += f"Score: {result['score']}"
comment += "\n"
if result["comment"].strip() != "":
comment += f"{result['comment']}\n"
total_score += result["score"] total_score += result["score"]
comment += "\n" comment += "\n"
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
title = f"JOJ3 Result {now} - Total Score: {total_score}" title = f"JOJ3 Result {now} - Score: {total_score}"
return title, comment return title, comment