From 9230be86e9de8328e13867c7fe604606544c91d1 Mon Sep 17 00:00:00 2001 From: dst03106 Date: Mon, 9 Jun 2025 21:40:33 +0900 Subject: [PATCH] refactor: handle singular/plural forms of entry --- pr_agent/algo/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index a106a7f3..aa231b86 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -281,12 +281,14 @@ def convert_to_markdown_v2(output_data: dict, markdown_todo_items = format_todo_items(value) EXPAND_LINE_THRESHOLD = 10 details_open_attr = " open" if markdown_todo_items.count("\n") + 1 <= EXPAND_LINE_THRESHOLD else "" + + todo_entry_label = f"{len(value)} " + "entries" if len(value) > 1 else "entry" if gfm_supported: markdown_text += "" if is_value_no(value): markdown_text += f"{emoji} No TODO sections" else: - markdown_text += f"{emoji} TODO sections ({len(value)} items)\n" + markdown_text += f"{emoji} TODO sections ({todo_entry_label})\n" markdown_text += f"{todos_summary}\n\n" markdown_text += markdown_todo_items markdown_text += "\n\n" @@ -295,7 +297,7 @@ def convert_to_markdown_v2(output_data: dict, if is_value_no(value): markdown_text += f"### {emoji} No TODO sections\n\n" else: - markdown_text += f"### {emoji} TODO sections ({len(value)} items)\n{todos_summary}\n\n" + markdown_text += f"### {emoji} TODO sections ({todo_entry_label})\n{todos_summary}\n\n" markdown_text += markdown_todo_items markdown_text += "\n\n\n" elif 'can be split' in key_nice.lower():