Skip to content

Commit 0ecfab7

Browse files
authored
Merge pull request #519 from github/zkoppert-hide-mentor-stats
fix: remove mentor count from stats if mentors are disabled
2 parents b243bbf + 717b382 commit 0ecfab7

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

issue_metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ def main(): # pragma: no cover
281281
search_query=search_query,
282282
hide_label_metrics=False,
283283
hide_items_closed_count=False,
284+
enable_mentor_count=enable_mentor_count,
284285
non_mentioning_links=False,
285286
report_title=report_title,
286287
output_file=output_file,
@@ -307,6 +308,7 @@ def main(): # pragma: no cover
307308
search_query=search_query,
308309
hide_label_metrics=False,
309310
hide_items_closed_count=False,
311+
enable_mentor_count=enable_mentor_count,
310312
non_mentioning_links=False,
311313
report_title=report_title,
312314
output_file=output_file,
@@ -370,6 +372,7 @@ def main(): # pragma: no cover
370372
search_query=search_query,
371373
hide_label_metrics=hide_label_metrics,
372374
hide_items_closed_count=hide_items_closed_count,
375+
enable_mentor_count=enable_mentor_count,
373376
non_mentioning_links=non_mentioning_links,
374377
report_title=report_title,
375378
output_file=output_file,

markdown_writer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def write_to_markdown(
100100
search_query=None,
101101
hide_label_metrics=False,
102102
hide_items_closed_count=False,
103+
enable_mentor_count=False,
103104
non_mentioning_links=False,
104105
report_title="",
105106
output_file="",
@@ -168,6 +169,7 @@ def write_to_markdown(
168169
file,
169170
hide_label_metrics,
170171
hide_items_closed_count,
172+
enable_mentor_count,
171173
)
172174

173175
# Write second table with individual issue/pr/discussion metrics
@@ -243,6 +245,7 @@ def write_overall_metrics_tables(
243245
file,
244246
hide_label_metrics,
245247
hide_items_closed_count=False,
248+
enable_mentor_count=False,
246249
):
247250
"""Write the overall metrics tables to the markdown file."""
248251
if any(
@@ -316,5 +319,6 @@ def write_overall_metrics_tables(
316319
file.write(f"| Number of items that remain open | {num_issues_opened} |\n")
317320
if not hide_items_closed_count:
318321
file.write(f"| Number of items closed | {num_issues_closed} |\n")
319-
file.write(f"| Number of most active mentors | {num_mentor_count} |\n")
322+
if enable_mentor_count:
323+
file.write(f"| Number of most active mentors | {num_mentor_count} |\n")
320324
file.write(f"| Total number of items created | {len(issues_with_metrics)} |\n\n")

test_markdown_writer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def test_write_to_markdown(self):
129129
"| --- | ---: |\n"
130130
"| Number of items that remain open | 2 |\n"
131131
"| Number of items closed | 1 |\n"
132-
"| Number of most active mentors | 5 |\n"
133132
"| Total number of items created | 2 |\n\n"
134133
"| Title | URL | Author | Time to first response | Time to close |"
135134
" Time to answer | Time in draft | Time spent in bug | Created At |\n"
@@ -240,7 +239,6 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
240239
"| --- | ---: |\n"
241240
"| Number of items that remain open | 2 |\n"
242241
"| Number of items closed | 1 |\n"
243-
"| Number of most active mentors | 5 |\n"
244242
"| Total number of items created | 2 |\n\n"
245243
"| Title | URL | Author | Time to first response | Time to close |"
246244
" Time to answer | Time in draft | Time spent in bug | Created At |\n"
@@ -369,6 +367,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
369367
search_query="repo:user/repo is:issue",
370368
hide_label_metrics=True,
371369
hide_items_closed_count=True,
370+
enable_mentor_count=True,
372371
non_mentioning_links=True,
373372
report_title="Issue Metrics",
374373
output_file="issue_metrics.md",

0 commit comments

Comments
 (0)