Skip to content

Commit

Permalink
Merge pull request #58 from DSACMS/fix-gauge-graphs
Browse files Browse the repository at this point in the history
Fix Incorrect Hover-Text in Pygals Gauge Graphs
  • Loading branch information
natalialuzuriaga authored Nov 27, 2023
2 parents c9943c0 + 7a46fe4 commit c50e122
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/gen_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,20 @@ def generate_solid_gauge_issue_graph(oss_entity):
def percent_formatter(x):
return '{:0.2f}%'.format(x)
issues_gauge.value_formatter = percent_formatter


#Generate graph to measure percentage of issues that are open
try:
#calculate portion of issues that are open.
open_issue_percent = oss_entity.metric_data['open_issues_count'] / \
oss_entity.metric_data['issues_count']
except ZeroDivisionError:
open_issue_percent = 0
issues_gauge.add(
'Open Issues', [{'value': open_issue_percent * 100, 'max_value': 100}])


try:
#calculate portion of pull requests that are open, merged, and closed
open_pr_percent = oss_entity.metric_data['open_pull_requests_count'] / \
oss_entity.metric_data['pull_requests_count']
merged_pr_percent = oss_entity.metric_data['merged_pull_requests_count'] / \
Expand All @@ -105,12 +109,15 @@ def percent_formatter(x):
merged_pr_percent = 0
closed_pr_percent = 0

#Generate graph to measure portion of pull requests that are open
issues_gauge.add('Open Pull Requests', [
{'value': open_pr_percent * 100, 'max_value': 100}])

#Generate graph to measure portion of pull requests that are merged or closed.
issues_gauge.add(
'Closed and Merged Pull Requests', [
{'value': merged_pr_percent * 100, 'max_value': 100},
{'value': closed_pr_percent * 100, 'max_value': 100}])
{'label': "Merged Pull Requests",'value': merged_pr_percent * 100, 'max_value': 100},
{'label': "Closed Pull Requests", 'value': closed_pr_percent * 100, 'max_value': 100}])

write_repo_chart_to_file(oss_entity, issues_gauge, "issue_gauge")

Expand Down

0 comments on commit c50e122

Please sign in to comment.