Skip to content

Commit

Permalink
Drifts count
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith committed Dec 8, 2024
1 parent 492fa8d commit b6f37e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/core/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,19 @@ def count_category_results(data):
spider_data = list()
result_counts = count_category_results(tree)

agg_drifts = list()

for key, content in tree.items():
total = sum(result_counts[content["urn"]].values())
ok_items = result_counts[content["urn"]].get("compliant", 0) + result_counts[
content["urn"]
].get("not_applicable", 0)
ok_perc = ceil(ok_items / total * 100) if total > 0 else 0
not_ok_count = total - ok_items
spider_data.append({"category": content["node_content"], "value": ok_perc})
agg_drifts.append(
{"name": content["node_content"], "drift_count": not_ok_count}
)

cnt_per_result = audit.get_requirements_result_count()
total = sum([res[0] for res in cnt_per_result])
Expand Down Expand Up @@ -282,6 +288,7 @@ def count_category_results(data):
},
"compliance_donut": res_donut,
"compliance_radar": chart_spider,
"drifts_per_domain": agg_drifts,
"chart_controls": ac_chart,
"p1_controls": p1_controls,
"ac_count": ac_total,
Expand Down
Binary file modified backend/core/templates/core/audit_report_template.docx
Binary file not shown.

0 comments on commit b6f37e3

Please sign in to comment.