Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter selected implementation groups in table mode #960

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,7 @@ def get_selected_implementation_groups(self):
if group.get("ref_id") in self.selected_implementation_groups
]

def get_requirement_assessments(self, include_non_assessable=False):
def get_requirement_assessments(self, include_non_assessable: bool):
"""
Returns sorted assessable requirement assessments based on the selected implementation groups.
If include_non_assessable is True, it returns all requirements regardless of their assessable status.
Expand Down
1 change: 1 addition & 0 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ class RequirementAssessmentReadSerializer(BaseModelSerializer):
evidences = FieldsRelatedField(many=True)
compliance_assessment = FieldsRelatedField()
folder = FieldsRelatedField()
assessable = serializers.BooleanField(source="requirement.assessable")

class Meta:
model = RequirementAssessment
Expand Down
16 changes: 10 additions & 6 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1805,9 +1805,11 @@ def action_plan(self, request, pk):
"active": [],
"deprecated": [],
}
compliance_assessment_object = self.get_object()
compliance_assessment_object: ComplianceAssessment = self.get_object()
requirement_assessments_objects = (
compliance_assessment_object.get_requirement_assessments()
compliance_assessment_object.get_requirement_assessments(
include_non_assessable=True
)
)
applied_controls = [
{
Expand Down Expand Up @@ -1920,9 +1922,11 @@ def action_plan_pdf(self, request, pk):
"--": "#e5e7eb",
}
status = AppliedControl.Status.choices
compliance_assessment_object = self.get_object()
compliance_assessment_object: ComplianceAssessment = self.get_object()
requirement_assessments_objects = (
compliance_assessment_object.get_requirement_assessments()
compliance_assessment_object.get_requirement_assessments(
include_non_assessable=True
)
)
applied_controls = (
AppliedControl.objects.filter(
Expand Down Expand Up @@ -2090,8 +2094,8 @@ def tree(self, request, pk):
@action(detail=True, methods=["get"])
def requirements_list(self, request, pk):
"""Returns the list of requirement assessments for the different audit modes"""
requirement_assessments_objects = (
self.get_object().get_requirement_assessments()
requirement_assessments_objects = self.get_object().get_requirement_assessments(
include_non_assessable=True
)
requirements_objects = RequirementNode.objects.filter(
framework=self.get_object().framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ export const load = (async ({ fetch, params }) => {
}
);
const observationBuffer = requirementAssessment.observation;
const assessable = true;
return {
...requirementAssessment,
evidenceCreateForm,
observationBuffer,
assessable
observationBuffer
};
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
</div>
</div>
{/if}
{#each data.requirements as requirementAssessment}
{#each data.requirement_assessments as requirementAssessment}
<div
class="flex flex-col items-center justify-center border pb-2 px-2 shadow-lg rounded-md space-y-2"
>
Expand Down
Loading