Skip to content

Commit

Permalink
comments from main forced decision PR resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ozayr-zaviar committed Dec 2, 2021
1 parent ed543fa commit 39ab0b0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions optimizely/decision_service.py
Expand Up @@ -356,14 +356,21 @@ def get_variation_for_rollout(self, project_config, feature, user):
return Decision(None, None, enums.DecisionSources.ROLLOUT), decide_reasons

rollout = project_config.get_rollout_from_id(feature.rolloutId)
rollout_rules = project_config.get_rollout_experiments(rollout)

if not rollout or not rollout_rules:
if not rollout:
message = 'There is no rollout of feature {}.'.format(feature.key)
self.logger.debug(message)
decide_reasons.append(message)
return Decision(None, None, enums.DecisionSources.ROLLOUT), decide_reasons

rollout_rules = project_config.get_rollout_experiments(rollout)

if not rollout_rules:
message = 'Rollout {} has no experiments.'.format(rollout.id)
self.logger.debug(message)
decide_reasons.append(message)
return Decision(None, None, enums.DecisionSources.ROLLOUT), decide_reasons

index = 0
while index < len(rollout_rules):
skip_to_everyone_else = False
Expand Down Expand Up @@ -478,4 +485,7 @@ def get_variation_for_feature(self, project_config, feature, user_context, optio
message = 'User "{}" is not bucketed into any of the experiments on the feature "{}".'.format(
user_context.user_id, feature.key)
self.logger.debug(message)
return self.get_variation_for_rollout(project_config, feature, user_context)
variation, rollout_variation_reasons = self.get_variation_for_rollout(project_config, feature, user_context)
if rollout_variation_reasons:
decide_reasons += rollout_variation_reasons
return variation, decide_reasons

0 comments on commit 39ab0b0

Please sign in to comment.