Skip to content

Commit

Permalink
fix missing fields in backend + improve front
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-intuitem committed Apr 9, 2024
1 parent 899317d commit e6c08cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 5 additions & 2 deletions backend/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,19 @@ def get_sorted_requirement_nodes_rec(
for requirement_node in requirement_nodes
if requirement_node.parent_urn == node.urn
]
req_as = requirement_assessment_from_requirement_id[str(node.id)]
result[str(node.id)] = {
"urn": node.urn,
"parent_urn": node.parent_urn,
"ref_id": node.ref_id,
"name": node.name,
"node_content": node.display_long,
"style": "node",
"assessable": node.assessable,
"description": node.description,
"ra_id": str(req_as.id),
"status": req_as.status,
"status_display": req_as.get_status_display(),
"status_i18n": camel_case(req_as.status),
"children": get_sorted_requirement_nodes_rec(
requirement_nodes, requirements_assessed, children
),
Expand All @@ -263,7 +267,6 @@ def get_sorted_requirement_nodes_rec(
"status": req_as.status,
"status_display": req_as.get_status_display(),
"status_i18n": camel_case(req_as.status),
"style": "leaf",
"threats": ThreatReadSerializer(
req.threats.all(), many=True
).data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,19 @@
if (nextValue) window.location.href = nextValue;
}
const title =
(data.parent.display_short ? data.parent.display_short + ': ' : '') +
data.requirement.display_short;
const child_pattern = (data.requirement.ref_id ? 2 : 0) + (data.requirement.name ? 1 : 0)
const child_title: string =
child_pattern == 3 ? `${data.requirement.ref_id} - ${data.requirement.name}` :
child_pattern == 2 ? data.requirement.ref_id :
child_pattern == 1 ? data.requirement.name : '';
const parent_pattern = (data.parent.ref_id ? 2 : 0) + (data.parent.name ? 1 : 0)
const parent_title: string =
parent_pattern == 3 ? `${data.parent.ref_id} - ${data.parent.name}` :
parent_pattern == 2 ? data.parent.ref_id :
parent_pattern == 1 ? data.parent.name : '';
const title = parent_pattern + child_title;
breadcrumbObject.set({
id: data.requirementAssessment.id,
name: title ?? 'Requirement assessment',
Expand Down

0 comments on commit e6c08cd

Please sign in to comment.