Skip to content

Commit d84ddfb

Browse files
Copilotzkoppert
andcommitted
feat: display all assignees instead of just primary assignee in markdown output
Co-authored-by: zkoppert <[email protected]>
1 parent d7d98d8 commit d84ddfb

File tree

2 files changed

+89
-5
lines changed

2 files changed

+89
-5
lines changed

markdown_writer.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,12 @@ def write_to_markdown(
208208
else:
209209
file.write(f"| {issue.title} | {issue.html_url} |")
210210
if "Assignee" in columns:
211-
if issue.assignee:
212-
file.write(
213-
f" [{issue.assignee}](https://{endpoint}/"
214-
f"{issue.assignee}) |"
215-
)
211+
if issue.assignees:
212+
assignee_links = [
213+
f"[{assignee}](https://{endpoint}/{assignee})"
214+
for assignee in issue.assignees
215+
]
216+
file.write(f" {', '.join(assignee_links)} |")
216217
else:
217218
file.write(" None |")
218219
if "Author" in columns:

test_assignee_functionality.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,89 @@ def test_assignee_column_position(self):
9595
"Assignee column should appear before Author column",
9696
)
9797

98+
def test_multiple_assignees_rendering_logic(self):
99+
"""Test that multiple assignees are rendered correctly in assignee column."""
100+
from classes import IssueWithMetrics
101+
from io import StringIO
102+
103+
# Test the assignee rendering logic directly
104+
endpoint = "github.com"
105+
columns = ["Title", "URL", "Assignee", "Author"]
106+
107+
# Test case 1: Multiple assignees
108+
issue_multiple = IssueWithMetrics(
109+
title="Test Issue with Multiple Assignees",
110+
html_url="https://github.com/test/repo/issues/1",
111+
author="testuser",
112+
assignee="alice",
113+
assignees=["alice", "bob", "charlie"]
114+
)
115+
116+
# Simulate the new rendering logic
117+
if "Assignee" in columns:
118+
if issue_multiple.assignees:
119+
assignee_links = [
120+
f"[{assignee}](https://{endpoint}/{assignee})"
121+
for assignee in issue_multiple.assignees
122+
]
123+
multiple_output = f" {', '.join(assignee_links)} |"
124+
else:
125+
multiple_output = " None |"
126+
127+
expected_multiple = " [alice](https://github.com/alice), [bob](https://github.com/bob), [charlie](https://github.com/charlie) |"
128+
self.assertEqual(multiple_output, expected_multiple,
129+
"Multiple assignees should be rendered as comma-separated links")
130+
131+
# Test case 2: Single assignee
132+
issue_single = IssueWithMetrics(
133+
title="Test Issue with Single Assignee",
134+
html_url="https://github.com/test/repo/issues/2",
135+
author="testuser",
136+
assignee="alice",
137+
assignees=["alice"]
138+
)
139+
140+
if "Assignee" in columns:
141+
if issue_single.assignees:
142+
assignee_links = [
143+
f"[{assignee}](https://{endpoint}/{assignee})"
144+
for assignee in issue_single.assignees
145+
]
146+
single_output = f" {', '.join(assignee_links)} |"
147+
else:
148+
single_output = " None |"
149+
150+
expected_single = " [alice](https://github.com/alice) |"
151+
self.assertEqual(single_output, expected_single,
152+
"Single assignee should be rendered as a single link")
153+
154+
# Test case 3: No assignees
155+
issue_none = IssueWithMetrics(
156+
title="Test Issue with No Assignees",
157+
html_url="https://github.com/test/repo/issues/3",
158+
author="testuser",
159+
assignee=None,
160+
assignees=[]
161+
)
162+
163+
if "Assignee" in columns:
164+
if issue_none.assignees:
165+
assignee_links = [
166+
f"[{assignee}](https://{endpoint}/{assignee})"
167+
for assignee in issue_none.assignees
168+
]
169+
none_output = f" {', '.join(assignee_links)} |"
170+
else:
171+
none_output = " None |"
172+
173+
expected_none = " None |"
174+
self.assertEqual(none_output, expected_none,
175+
"No assignees should be rendered as 'None'")
176+
177+
print(f"✅ Multiple assignees test: {expected_multiple}")
178+
print(f"✅ Single assignee test: {expected_single}")
179+
print(f"✅ No assignees test: {expected_none}")
180+
98181

99182
if __name__ == "__main__":
100183
unittest.main()

0 commit comments

Comments
 (0)