Skip to content

Commit

Permalink
Changing lookup of experiment in decision service to use experiment I…
Browse files Browse the repository at this point in the history
…D instead of key to resolve bug
  • Loading branch information
The-inside-man committed Jul 9, 2021
1 parent 8c3cfc1 commit 12de61b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions optimizely/decision_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def get_variation_for_rollout(self, project_config, rollout, user_id, attributes
if rollout and len(rollout.experiments) > 0:
for idx in range(len(rollout.experiments) - 1):
logging_key = str(idx + 1)
rollout_rule = project_config.get_experiment_from_key(rollout.experiments[idx].get('key'))
rollout_rule = project_config.get_experiment_from_id(rollout.experiments[idx].get('id'))

# Check if user meets audience conditions for targeting rule
audience_conditions = rollout_rule.get_audience_conditions_or_ids()
Expand Down Expand Up @@ -387,7 +387,7 @@ def get_variation_for_rollout(self, project_config, rollout, user_id, attributes
break

# Evaluate last rule i.e. "Everyone Else" rule
everyone_else_rule = project_config.get_experiment_from_key(rollout.experiments[-1].get('key'))
everyone_else_rule = project_config.get_experiment_from_id(rollout.experiments[-1].get('id'))
audience_conditions = everyone_else_rule.get_audience_conditions_or_ids()
audience_eval, audience_reasons = audience_helper.does_user_meet_audience_conditions(
project_config,
Expand Down

0 comments on commit 12de61b

Please sign in to comment.