Skip to content

Commit

Permalink
Codefactor fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurswag committed Oct 21, 2024
1 parent 60c091d commit 6a78979
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,14 +963,9 @@ def duplicate(self, request, pk):
cost=applied_control.cost,
)
if request.data["duplicate_evidences"]:
for evidence in applied_control.evidences.all():
# Evidences will only be duplicated if necessary
if new_folder.can_access(evidence.folder):
duplicate_applied_control.evidences.add(evidence)
else:
new_evidence = evidence.duplicate_into_folder(new_folder)
duplicate_applied_control.evidences.add(new_evidence)

duplicate_related_objects(applied_control, duplicate_applied_control, new_folder, "evidences")
# Delete the can_access method
# Delete the duplicate_into_folder method
duplicate_applied_control.save()

return Response({"results": "applied control duplicated"})
Expand Down

0 comments on commit 6a78979

Please sign in to comment.