Skip to content

Commit

Permalink
👻 [Backport][MTA-1973] Change assessed logic for archetypes to handle…
Browse files Browse the repository at this point in the history
… zero required (#609)

@ibolton336:
> 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]>
Co-authored-by: Ian Bolton <[email protected]>
  • Loading branch information
mansam and ibolton336 authored Feb 28, 2024
1 parent 0633e37 commit 95ffdfd
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 @@ -51,6 +51,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 95ffdfd

Please sign in to comment.