Skip to content

fix: remove mentor count from stats if mentors are disabled #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions issue_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ def main(): # pragma: no cover
search_query=search_query,
hide_label_metrics=False,
hide_items_closed_count=False,
enable_mentor_count=enable_mentor_count,
non_mentioning_links=False,
report_title=report_title,
output_file=output_file,
Expand All @@ -307,6 +308,7 @@ def main(): # pragma: no cover
search_query=search_query,
hide_label_metrics=False,
hide_items_closed_count=False,
enable_mentor_count=enable_mentor_count,
non_mentioning_links=False,
report_title=report_title,
output_file=output_file,
Expand Down Expand Up @@ -370,6 +372,7 @@ def main(): # pragma: no cover
search_query=search_query,
hide_label_metrics=hide_label_metrics,
hide_items_closed_count=hide_items_closed_count,
enable_mentor_count=enable_mentor_count,
non_mentioning_links=non_mentioning_links,
report_title=report_title,
output_file=output_file,
Expand Down
6 changes: 5 additions & 1 deletion markdown_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def write_to_markdown(
search_query=None,
hide_label_metrics=False,
hide_items_closed_count=False,
enable_mentor_count=False,
non_mentioning_links=False,
report_title="",
output_file="",
Expand Down Expand Up @@ -168,6 +169,7 @@ def write_to_markdown(
file,
hide_label_metrics,
hide_items_closed_count,
enable_mentor_count,
)

# Write second table with individual issue/pr/discussion metrics
Expand Down Expand Up @@ -243,6 +245,7 @@ def write_overall_metrics_tables(
file,
hide_label_metrics,
hide_items_closed_count=False,
enable_mentor_count=False,
):
"""Write the overall metrics tables to the markdown file."""
if any(
Expand Down Expand Up @@ -316,5 +319,6 @@ def write_overall_metrics_tables(
file.write(f"| Number of items that remain open | {num_issues_opened} |\n")
if not hide_items_closed_count:
file.write(f"| Number of items closed | {num_issues_closed} |\n")
file.write(f"| Number of most active mentors | {num_mentor_count} |\n")
if enable_mentor_count:
file.write(f"| Number of most active mentors | {num_mentor_count} |\n")
file.write(f"| Total number of items created | {len(issues_with_metrics)} |\n\n")
3 changes: 1 addition & 2 deletions test_markdown_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def test_write_to_markdown(self):
"| --- | ---: |\n"
"| Number of items that remain open | 2 |\n"
"| Number of items closed | 1 |\n"
"| Number of most active mentors | 5 |\n"
"| Total number of items created | 2 |\n\n"
"| Title | URL | Author | Time to first response | Time to close |"
" Time to answer | Time in draft | Time spent in bug | Created At |\n"
Expand Down Expand Up @@ -240,7 +239,6 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
"| --- | ---: |\n"
"| Number of items that remain open | 2 |\n"
"| Number of items closed | 1 |\n"
"| Number of most active mentors | 5 |\n"
"| Total number of items created | 2 |\n\n"
"| Title | URL | Author | Time to first response | Time to close |"
" Time to answer | Time in draft | Time spent in bug | Created At |\n"
Expand Down Expand Up @@ -369,6 +367,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
search_query="repo:user/repo is:issue",
hide_label_metrics=True,
hide_items_closed_count=True,
enable_mentor_count=True,
non_mentioning_links=True,
report_title="Issue Metrics",
output_file="issue_metrics.md",
Expand Down
Loading