Skip to content

Commit

Permalink
Merge pull request #89 from harness/FFM-3625
Browse files Browse the repository at this point in the history
FFM-3625 - Flags with pre-reqs always evaluating to off state
  • Loading branch information
stephenmcconkey committed Jun 22, 2022
2 parents dc7a058 + 17dbde7 commit 82779d3
Show file tree
Hide file tree
Showing 2 changed files with 619 additions and 4 deletions.
11 changes: 7 additions & 4 deletions evaluation/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,21 @@ func prereqsSatisfied(fc FeatureConfig, target *Target, flags map[string]Feature
}

prereqsSatisfied := true
for _, pre := range fc.Prerequisites {

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 _, variation := range pre.Variations {
if variation != variationToMatch.Value {
return false
}
}
}
}

Expand Down
Loading

0 comments on commit 82779d3

Please sign in to comment.