Skip to content

Commit

Permalink
Fix requirement assessment status counts in HTML export
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Feb 29, 2024
1 parent 84bff37 commit 439751a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ def generate_html(
)

assessments = RequirementAssessment.objects.filter(
compliance_assessment=compliance_assessment
compliance_assessment=compliance_assessment,
).all()

node_per_urn = {r.urn: r for r in requirement_nodes}
Expand All @@ -1366,7 +1366,9 @@ def bar_graph(node: RequirementNode):
content = ""
compliance_assessments_status = []
candidates = [
c for c in assessments if not (node) or c == node or node in ancestors[c]
c
for c in assessments.filter(requirement__assessable=True)
if not (node) or c == node or node in ancestors[c]
]
total = len(candidates)
for st in RequirementAssessment.Status:
Expand All @@ -1388,9 +1390,11 @@ def bar_graph(node: RequirementNode):
content += "bg-green-500"
elif stat[0] == "not_applicable":
content += "bg-black text-white dark:bg-white dark:text-black"
content += (
'" style="width:' + str(stat[1]) + '%"> ' + str(stat[1]) + "%</div>"
)
content += '" style="width:' + str(stat[1]) + '%"> '
if stat[0] != "to_do":
content += str(stat[1]) + "%"

content += "</div>"
content += "</div></div>"
return content

Expand Down

0 comments on commit 439751a

Please sign in to comment.