From 1339a1cf086867ee92a81a77ebb6cd5d8e9301fe Mon Sep 17 00:00:00 2001 From: ibolton336 Date: Wed, 18 Oct 2023 13:46:14 -0400 Subject: [PATCH] :bug: Prevent apps from assessed by default on initial creation Signed-off-by: ibolton336 --- assessment/application.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assessment/application.go b/assessment/application.go index 307cba291..1a577a360 100644 --- a/assessment/application.go +++ b/assessment/application.go @@ -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 @@ -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 }