Skip to content

Commit

Permalink
🧹 Use average scoring for frameworks
Browse files Browse the repository at this point in the history
Frameworks get controls. Controls are pass or fail (0 or 100). By
changing the scoring system to average, the value of the framework score
is the completion
  • Loading branch information
jaym committed Aug 3, 2023
1 parent da6485a commit 1720864
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions policy/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ func (s *LocalServices) jobsToFrameworksInner(cache *frameworkResolverCache, res
Uuid: uuid,
QrId: childFramework.Mrn,
ChildJobs: map[string]*explorer.Impact{},
ScoringSystem: explorer.ScoringSystem_WORST,
ScoringSystem: explorer.ScoringSystem_AVERAGE,
Type: ReportingJob_FRAMEWORK,
}
}
Expand All @@ -1478,7 +1478,7 @@ func (s *LocalServices) jobsToFrameworksInner(cache *frameworkResolverCache, res
// overwrite it as that would change the scoring system
impact := &explorer.Impact{}
if parent.Type == ReportingJob_FRAMEWORK {
impact.Scoring = explorer.ScoringSystem_WORST
impact.Scoring = explorer.ScoringSystem_AVERAGE
} else {
impact.Scoring = explorer.ScoringSystem_IGNORE_SCORE
}
Expand Down
2 changes: 2 additions & 0 deletions policy/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ func (tester *frameworkReportingJobTester) requireReportsTo(childQueryId string,

if isFramework(parentQueryId) {
require.Equal(tester.t, policy.ReportingJob_FRAMEWORK, parentRj.Type)
require.Equal(tester.t, explorer.ScoringSystem_AVERAGE, parentRj.ScoringSystem)
} else if isControl(parentQueryId) {
require.Equal(tester.t, policy.ReportingJob_CONTROL, parentRj.Type)
} else if isPolicy(parentQueryId) || parentQueryId == "root" {
Expand All @@ -515,6 +516,7 @@ func (tester *frameworkReportingJobTester) requireReportsTo(childQueryId string,
require.Equal(tester.t, policy.ReportingJob_CONTROL, childRj.Type)
} else if isFramework(childQueryId) {
require.Equal(tester.t, policy.ReportingJob_FRAMEWORK, childRj.Type)
require.Equal(tester.t, explorer.ScoringSystem_AVERAGE, childRj.ScoringSystem)
} else if isPolicy(childQueryId) {
require.Equal(tester.t, policy.ReportingJob_POLICY, childRj.Type)
} else {
Expand Down

0 comments on commit 1720864

Please sign in to comment.