From 0ad1e9540ac66d0d3cde269f2dd23904afbecaa5 Mon Sep 17 00:00:00 2001
From: BoYanZh <boyanzh233@gmail.com>
Date: Wed, 30 Oct 2024 17:49:20 -0400
Subject: [PATCH] feat: option to remove submitter in issue title

---
 joint_teapot/app.py        | 5 +++++
 joint_teapot/utils/joj3.py | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/joint_teapot/app.py b/joint_teapot/app.py
index 202bab9..014797c 100644
--- a/joint_teapot/app.py
+++ b/joint_teapot/app.py
@@ -475,6 +475,10 @@ def joj3_all(
         False,
         help="skip creating failed table on gitea",
     ),
+    submitter_in_issue_title: bool = Option(
+        True,
+        help="whether to include submitter in issue title",
+    ),
 ) -> None:
     set_settings(Settings(_env_file=env_path))
     set_logger(settings.stderr_log_level, diagnose=False, backtrace=False)
@@ -497,6 +501,7 @@ def joj3_all(
             exercise_name,
             submitter,
             commit_hash,
+            submitter_in_issue_title,
         )
         title_prefix = joj3.get_title_prefix(title)
         joj3_issue: focs_gitea.Issue
diff --git a/joint_teapot/utils/joj3.py b/joint_teapot/utils/joj3.py
index 45dd767..a0b24e9 100644
--- a/joint_teapot/utils/joj3.py
+++ b/joint_teapot/utils/joj3.py
@@ -186,6 +186,7 @@ def generate_title_and_comment(
     exercise_name: str,
     submitter: str,
     commit_hash: str,
+    submitter_in_title: bool = True,
 ) -> Tuple[str, str]:
     with open(score_file_path) as json_file:
         stages: List[Dict[str, Any]] = json.load(json_file)
@@ -225,6 +226,8 @@ def generate_title_and_comment(
             total_score += result["score"]
         comment += "\n"
     title = f"JOJ3 Result for {exercise_name} by @{submitter} - Score: {total_score}"
+    if not submitter_in_title:
+        title = f"JOJ3 Result for {exercise_name} - Score: {total_score}"
     return title, comment