Skip to content

Commit b859dc2

Browse files
committed
Implement comment
1 parent ae9da48 commit b859dc2

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

lib/optimizely/config/datafile_project_config.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,12 @@ def initialize(datafile, logger, error_handler)
128128
if holdout['includedFlags'].nil? || holdout['includedFlags'].empty?
129129
@global_holdouts[holdout['id']] = holdout
130130

131-
holdout['excludedFlags']&.each do |flag_id|
132-
@excluded_holdouts[flag_id] ||= []
133-
@excluded_holdouts[flag_id] << holdout
131+
excluded_flags = holdout['excludedFlags']
132+
if excluded_flags && !excluded_flags.empty?
133+
excluded_flags.each do |flag_id|
134+
@excluded_holdouts[flag_id] ||= []
135+
@excluded_holdouts[flag_id] << holdout
136+
end
134137
end
135138
else
136139
holdout['includedFlags'].each do |flag_id|
@@ -615,8 +618,9 @@ def get_holdouts_for_flag(flag_key)
615618
# Add global holdouts that don't exclude this flag
616619
@global_holdouts.each_value do |holdout|
617620
is_excluded = false
618-
if holdout.key?('excludedFlags')
619-
holdout['excludedFlags'].each do |excluded_flag_id|
621+
excluded_flags = holdout['excludedFlags']
622+
if excluded_flags && !excluded_flags.empty?
623+
excluded_flags.each do |excluded_flag_id|
620624
if excluded_flag_id == flag_id
621625
is_excluded = true
622626
break

0 commit comments

Comments
 (0)