Skip to content

Commit

Permalink
👻 Change assessed logic for archetypes to handle zero required (#601)
Browse files Browse the repository at this point in the history
- Currently when no required questionnaires exist, archetypes are marked
as `assessed:true` which results in additional UI code to rule out this
case when calculating status. This PR aims to return `assessed: false`
in the case of zero required assessments for an archetype.

Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 authored Feb 13, 2024
1 parent ae2295a commit e1fa5f6
Showing 1 changed file with 3 additions and 0 deletions.
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 e1fa5f6

Please sign in to comment.