Skip to content

Commit

Permalink
Merge pull request #269 from DSACMS/sachin/avg-commit-counts
Browse files Browse the repository at this point in the history
Added Frontend and Backend for Average Issue Resolution Time Graph
  • Loading branch information
IsaacMilarky authored Oct 18, 2024
2 parents 5e032ef + 88e00a1 commit 9922c8f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
30 changes: 29 additions & 1 deletion scripts/gen_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import re
import pygal


def percent_formatter(x):
"""
Function to format percentage values.
Expand Down Expand Up @@ -59,6 +58,7 @@ def generate_all_graphs_for_repos(all_repos):
generate_language_summary_pie_chart(repo)
generate_cost_estimates_bar_chart(repo)
generate_time_estimates_bar_chart(repo)
generate_average_issue_resolution_graph(repo)
try:
generate_donut_graph_line_complexity_graph(repo)
generate_time_xy_issue_graph(
Expand Down Expand Up @@ -567,3 +567,31 @@ def generate_people_estimate_bar_chart(oss_entity):
bar_chart.add(None, [0])

write_repo_chart_to_file(oss_entity, bar_chart, "estimated_people_contributing")

def generate_average_issue_resolution_graph(oss_entity):
"""
This function generates a pygal gauge chart for average issue resolution time.
Arguments:
oss_entity: An object containing the metric data.
"""
gauge_graph = pygal.Gauge(legend_at_bottom=True)

metric_data = oss_entity.metric_data.get('average_issue_resolution_time')
if not metric_data or not metric_data[0]:
print("No data available for average issue resolution time")
return

data = metric_data[0]
repo_name = data[0]
average_time_str = data[1]

days_str = average_time_str.split(' days ')
days = int(days_str[0])

gauge_graph.range = [0, round((days + 20))]

gauge_graph.title = f"Average Issue Resolution Time for {repo_name} \n Average Time: {round(days)} days"
gauge_graph.add("Days", round(days))

write_repo_chart_to_file(oss_entity, gauge_graph, "average_issue_resolution_time")
10 changes: 9 additions & 1 deletion scripts/metricsLib/metrics_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
AUGUR_HOST + "/pull_request_reports/PR_time_to_first_response/" +
"?repo_id={repo_id}&start_date={begin_month}&end_date={end_date}"))


ORG_GITHUB_GRAPHQL_QUERY = """
query ($org_login: String!) {
organization(login: $org_login) {
Expand Down Expand Up @@ -252,3 +251,12 @@
}
)
)

SIMPLE_METRICS.append(ListMetric("averageIssueResolutionTime", sixMonthsParams, AUGUR_HOST + "/repos/" + "{repo_id}" + "/average-issue-resolution-time", {"average_issue_resolution_time": ["repo_name", "avg_issue_resolution_time"]}))

# Metric for Average Commit Counts per PR
# TODO: - Currently not working because of something wrong on Augur's end. Develop a solution here (hacky) or fix upstream.

# RESOURCE_METRICS.append(ResourceMetric("averageCommitsPerPR", sixMonthsParams,
# AUGUR_HOST + "/pull_request_reports/average_commits_per_PR/" +
# "?repo_id={repo_id}&start_date={begin_month}&end_date={end_date}"))
2 changes: 2 additions & 0 deletions templates/repo_report_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ date_stampLastWeek: {date_stamp}
{{% assign optionsArray = 'Summary, Predominant' | split: ',' %}}
{{% assign graphsArray = "/{repo_owner}/{repo_name}/language_summary_{repo_name}_data.svg, /{repo_owner}/{repo_name}/predominant_langs_{repo_name}_data.svg" | split: ',' %}}
{{% render "graph-toggle" baseurl: site.baseurl, name:"language-information" options: optionsArray, graphs: graphsArray, title: "Language Information" %}}
<!-- Average Issue Resolution Time -->
{{% render "graph-section" baseurl: site.baseurl, path: "/{repo_owner}/{repo_name}/average_issue_resolution_time_{repo_name}_data.svg", title: "Average Issue Resolution Time" %}}
<!-- Libyear Timeline Graph -->
{{% render "graph-section" baseurl: site.baseurl, path: "/{repo_owner}/{repo_name}/libyear_timeline_{repo_name}_data.svg", title: "Dependency Libyears" %}}
<!-- DRYness Percentages Graph -->
Expand Down

0 comments on commit 9922c8f

Please sign in to comment.