Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions evaluation/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,30 @@ func prereqsSatisfied(fc FeatureConfig, target *Target, flags map[string]Feature
}

prereqsSatisfied := true
satisfiedCount := 0

for _, pre := range fc.Prerequisites {

prereqFlag, ok := flags[pre.Feature]
if !ok {
continue
}

variation := fc.Variations.FindByIdentifier(fc.GetVariationName(target))
variationToMatch := prereqFlag.Variations.FindByIdentifier(prereqFlag.GetVariationName(target))

if variation.Value != variationToMatch.Value {
prereqsSatisfied = false
if pre.Feature == prereqFlag.Feature {
for _, x := range pre.Variations {
if x == variationToMatch.Value {
satisfiedCount++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we break outer loop and return false, instead of introducing new local var

}
}
}
}

if satisfiedCount != len(fc.Prerequisites) {
prereqsSatisfied = false
}

return prereqsSatisfied
}

Expand Down
Loading