Skip to content

Commit

Permalink
Codefactor fix 3
Browse files Browse the repository at this point in the history
Remove useless comments
  • Loading branch information
monsieurswag committed Oct 21, 2024
1 parent b6cf0f9 commit f710de5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,8 @@ def duplicate(self, request, pk):
{"results": "applied control duplicated"}, status=HTTP_404_NOT_FOUND
)

applied_control = self.get_object()
data = request.data
new_folder = Folder.objects.get(id=data["folder"])
duplicate_applied_control = AppliedControl.objects.create(
def duplicate_into_folder(applied_control: AppliedControl, data: dict, folder: Folder) -> AppliedControl :
return duplicate_applied_control = AppliedControl.objects.create(
reference_control=applied_control.reference_control,
name=data["name"],
description=data["description"],
Expand All @@ -968,12 +966,16 @@ def duplicate(self, request, pk):
effort=applied_control.effort,
cost=applied_control.cost,
)

applied_control = self.get_object()
data = request.data
new_folder = Folder.objects.get(id=data["folder"])
duplicate_applied_control = duplicate_into_folder(applied_control, data, new_folder)

if data["duplicate_evidences"]:
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 f710de5

Please sign in to comment.