Skip to content

Commit

Permalink
👻 Return false when no required questionnaires
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Feb 13, 2024
1 parent e18a654 commit 9fd38d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assessment/archetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (r *ArchetypeResolver) Confidence() (confidence int) {
// Assessed returns whether the archetype has been fully assessed.
func (r *ArchetypeResolver) Assessed() (assessed bool) {
if r.questionnaire == nil {
return
return false
}
assessed = r.questionnaire.Assessed(r.RequiredAssessments())
return
Expand Down
3 changes: 3 additions & 0 deletions assessment/questionnaire.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func (r *QuestionnaireResolver) Required(id uint) (required bool) {
// Assessed returns whether a slice contains a completed assessment for each of the required
// questionnaires.
func (r *QuestionnaireResolver) Assessed(assessments []Assessment) (assessed bool) {
if r.requiredQuestionnaires.Size() == 0 {
return false
}
answered := NewSet()
for _, a := range assessments {
if r.requiredQuestionnaires.Contains(a.QuestionnaireID) {
Expand Down

0 comments on commit 9fd38d5

Please sign in to comment.