Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Use average scoring for frameworks #678

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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