Skip to content

Commit

Permalink
Fix tests and too much permissive score copying
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurswag committed Jan 3, 2025
1 parent 6bfa724 commit 0614bf3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2476,13 +2476,13 @@ def perform_create(self, serializer):
)
instance: ComplianceAssessment = serializer.save()
instance.create_requirement_assessments(baseline)
target_framework = serializer.validated_data["framework"]
source_framework = baseline.framework
same_minmax_score = (
target_framework.min_score == source_framework.min_score
and target_framework.max_score == source_framework.max_score
)
if baseline and baseline.framework != instance.framework:
target_framework = serializer.validated_data["framework"]
source_framework = baseline.framework
same_minmax_score = (
target_framework.min_score == source_framework.min_score
and target_framework.max_score == source_framework.max_score
)
mapping_set = RequirementMappingSet.objects.get(
target_framework=target_framework,
source_framework=baseline.framework,
Expand All @@ -2497,7 +2497,7 @@ def perform_create(self, serializer):
"source_requirement_assessment"
]["id"]
)
if same_minmax_score:
if same_minmax_score and target_framework == source_framework:
requirement_assessment.is_scored = (
baseline_requirement_assessment.is_scored
)
Expand Down

0 comments on commit 0614bf3

Please sign in to comment.