Skip to content

Commit

Permalink
Add a more verbose and complete counting of results
Browse files Browse the repository at this point in the history
  • Loading branch information
Fynardo committed Nov 14, 2024
1 parent fbeeafa commit f0a1054
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions backend/ibutsu_server/widgets/importance_component.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from collections import defaultdict

from ibutsu_server.constants import BARCHART_MAX_BUILDS, JJV_RUN_LIMIT
from ibutsu_server.db.models import Result, Run
from ibutsu_server.filters import string_to_column
Expand Down Expand Up @@ -92,21 +94,33 @@ def get_importance_component(
sdatdict[component][bnum][importance] = []

# this is to change result values into numbers
# TODO: This now handles skipped, but not xpassed or xfailed.
for component in sdatdict.keys():
for bnum in sdatdict[component].keys():
for importance in sdatdict[component][bnum].keys():
results_dict = defaultdict(int)
total = 0
passed = 0
res_list = []
for item in sdatdict[component][bnum][importance]:
if count_skips or (not item["result"] == "skipped"):
total += 1
total += 1
results_dict[item["result"]] += 1
res_list.append(item["result_id"])
if item["result"] == "passed":
passed += 1

if total != 0:
if count_skips:
passed = total - (
results_dict["error"]
+ results_dict["skipped"]
+ results_dict["failed"]
+ results_dict["xpassed"]
+ results_dict["xfailed"]
)
else:
passed = total - (
results_dict["error"]
+ results_dict["failed"]
+ results_dict["xpassed"]
+ results_dict["xfailed"]
)
sdatdict[component][bnum][importance] = {
"percentage": round(passed / total, 2),
"result_list": res_list,
Expand Down

0 comments on commit f0a1054

Please sign in to comment.