Skip to content

Commit

Permalink
🐛 Prevent apps from assessed by default on initial creation
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Oct 18, 2023
1 parent f53137d commit 1339a1c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions assessment/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ func (r *ApplicationResolver) AssessmentTags() (tags []model.Tag) {
return
}

//
// Assessed returns whether the application has been fully assessed.
func (r *ApplicationResolver) Assessed() (assessed bool, err error) {
// if the application has any of its own assessments, only consider them for
Expand All @@ -99,16 +98,19 @@ func (r *ApplicationResolver) Assessed() (assessed bool, err error) {
assessed = r.questionnaireResolver.Assessed(r.application.Assessments)
return
}
assessed = false

// otherwise the application is assessed if all of its archetypes are fully assessed.
archetypes, err := r.Archetypes()
if err != nil {
return
}
assessedCount := 0
for _, a := range archetypes {
if !r.questionnaireResolver.Assessed(a.Assessments) {
return
if r.questionnaireResolver.Assessed(a.Assessments) {
assessedCount++
}
}
assessed = true
assessed = assessedCount > 0 && assessedCount == len(archetypes)
return
}

0 comments on commit 1339a1c

Please sign in to comment.