From b128625bce2512bcd759ad97fda6e458879a93fd Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Mon, 30 Sep 2024 05:31:13 -0400 Subject: [PATCH] feat: update joj3 format --- joint_teapot/app.py | 8 ++++---- joint_teapot/utils/joj3.py | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/joint_teapot/app.py b/joint_teapot/app.py index b0ff5e0..0db1851 100644 --- a/joint_teapot/app.py +++ b/joint_teapot/app.py @@ -242,9 +242,8 @@ def joj3_scoreboard( submitter, 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( - 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, 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( - 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}", ) diff --git a/joint_teapot/utils/joj3.py b/joint_teapot/utils/joj3.py index 51c22c8..8ca09bf 100644 --- a/joint_teapot/utils/joj3.py +++ b/joint_teapot/utils/joj3.py @@ -172,17 +172,23 @@ def generate_title_and_comment( stages: List[Dict[str, Any]] = json.load(json_file) total_score = 0 - comment = f"[Gitea Actions]({action_link})\n" + comment = f"Generated by [Gitea Actions]({action_link})\n" for stage in stages: comment += f"## {stage['name']}\n" + single_case = len(stage["results"]) == 1 for i, result in enumerate(stage["results"]): - comment += f"### case {i}\n" - comment += f"score: {result['score']}\n" - comment += f"comment: {result['comment']}\n" + comment += "### " + if not single_case: + 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"] comment += "\n" 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