Skip to content

Commit

Permalink
fix: duplicate scenario ref_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Dec 6, 2024
1 parent 6f60f14 commit 7c753e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,20 +850,21 @@ def duplicate(self, request, pk):
residual_impact=scenario.residual_impact,
strength_of_knowledge=scenario.strength_of_knowledge,
justification=scenario.justification,
ref_id=scenario.ref_id,
)

for field in ["applied_controls", "threats", "assets"]:
duplicate_related_objects(
scenario,
duplicate_scenario,
duplicate_risk_assessment.project.folder,
duplicate_risk_assessment.folder,
field,
)

if (
duplicate_risk_assessment.project.folder
in [risk_assessment.project.folder]
+ risk_assessment.project.folder.sub_folders()
duplicate_risk_assessment.folder
in [risk_assessment.folder]
+ [risk for risk in risk_assessment.folder.get_sub_folders()]
):
duplicate_scenario.owner.set(scenario.owner.all())

Expand Down

0 comments on commit 7c753e1

Please sign in to comment.