Skip to content

Commit c0d90f5

Browse files
author
Shiva Adirala
committed
Fix issue with pie charts percentage calc
1 parent 4e53b06 commit c0d90f5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

robotframework_metrics/robotmetrics.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def generate_report(opts):
217217
passed_suite = test_stats.passed_suite
218218
failed_suite = test_stats.failed_suite
219219

220-
suitepp = math.ceil(passed_suite * 100.0 / total_suite)
221-
suitefp = math.ceil(failed_suite * 100.0 / total_suite)
220+
suitepp = round(passed_suite * 100.0 / total_suite, 1)
221+
suitefp = round(failed_suite * 100.0 / total_suite, 1)
222222
elapsedtime = datetime(1970, 1, 1) + timedelta(milliseconds=result.suite.elapsedtime)
223223
elapsedtime = elapsedtime.strftime("%X")
224224
my_results = result.generated_by_robot
@@ -233,8 +233,8 @@ def generate_report(opts):
233233
passed = stats.total.all.passed
234234
failed = stats.total.all.failed
235235

236-
testpp = round(passed * 100.0 / total, 2)
237-
testfp = round(failed * 100.0 / total, 2)
236+
testpp = round(passed * 100.0 / total, 1)
237+
testfp = round(failed * 100.0 / total, 1)
238238

239239
kw_stats = KeywordStats(ignore_library, ignore_type)
240240
result.visit(kw_stats)
@@ -245,8 +245,8 @@ def generate_report(opts):
245245

246246
# Handling ZeroDivisionError exception when no keywords are found
247247
if total_keywords > 0:
248-
kwpp = round(passed_keywords * 100.0 / total_keywords, 2)
249-
kwfp = round(failed_keywords * 100.0 / total_keywords, 2)
248+
kwpp = round(passed_keywords * 100.0 / total_keywords, 1)
249+
kwfp = round(failed_keywords * 100.0 / total_keywords, 1)
250250
else:
251251
kwpp = 0
252252
kwfp = 0
@@ -873,13 +873,13 @@ def generate_report(opts):
873873
</tr>
874874
<tr>
875875
<td>
876-
<img src='https://chart.googleapis.com/chart?cht=p3&chd=t:suite_pass,suite_fail&chs=250x200&chco=3BB032|bc2d29&chdl=suite-pass-perc-pass|suite-fail-perc-fail'/>
876+
<img src='https://chart.googleapis.com/chart?cht=p3&chd=t:suite-pass-perc,suite-fail-perc&chs=250x200&chco=3BB032|bc2d29&chdl=suite-pass-perc-pass|suite-fail-perc-fail'/>
877877
</td>
878878
<td>
879-
<img src='https://chart.googleapis.com/chart?cht=p3&chd=t:test_pass,test_fail&chs=250x200&chco=3BB032|bc2d29&chdl=test-pass-perc-pass|test-fail-perc-fail'/>
879+
<img src='https://chart.googleapis.com/chart?cht=p3&chd=t:test-pass-perc,test-fail-perc&chs=250x200&chco=3BB032|bc2d29&chdl=test-pass-perc-pass|test-fail-perc-fail'/>
880880
</td>
881881
<td>
882-
<img src='https://chart.googleapis.com/chart?cht=p3&chd=t:keyword_pass,keyword_fail&chs=250x200&chco=3BB032|bc2d29&chdl=keyword-pass-perc-pass|keyword-fail-perc-fail'/>
882+
<img src='https://chart.googleapis.com/chart?cht=p3&chd=t:keyword-pass-perc,keyword-fail-perc&chs=250x200&chco=3BB032|bc2d29&chdl=keyword-pass-perc-pass|keyword-fail-perc-fail'/>
883883
</td>
884884
</tr>
885885
</tbody>

0 commit comments

Comments
 (0)