Skip to content

Commit bbd88f7

Browse files
-updated experiment_id and variation_id fetching logic
-removed redundant function from project_config.py
1 parent f58713f commit bbd88f7

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

optimizely/optimizely.py

-12
Original file line numberDiff line numberDiff line change
@@ -1203,18 +1203,6 @@ def _create_optimizely_decision(
12031203
else None
12041204
)
12051205

1206-
# rollout_id = None
1207-
# if decision_source == DecisionSources.ROLLOUT and feature_flag is not None:
1208-
# rollout_id = feature_flag.rolloutId
1209-
# experiment_id = None
1210-
# if rule_key is not None:
1211-
# experiment_id = project_config.get_experiment_id_by_key_or_rollout_id(rule_key, rollout_id)
1212-
# variation_id = None
1213-
# if experiment_id and variation_key:
1214-
# variation = project_config.get_variation_from_key_by_experiment_id(experiment_id, variation_key)
1215-
# if variation:
1216-
# variation_id = variation.id
1217-
12181206
experiment_id = None
12191207
variation_id = None
12201208

optimizely/project_config.py

-28
Original file line numberDiff line numberDiff line change
@@ -716,31 +716,3 @@ def get_flag_variation(
716716
return variation
717717

718718
return None
719-
720-
def get_experiment_id_by_key_or_rollout_id(self, key: str, rollout_id: Optional[str] = None) -> Optional[str]:
721-
"""
722-
Retrieves the experiment ID associated with a given rule key or a specific rollout.
723-
724-
Args:
725-
key: The key associated with the experiment rule. It can be experiment key or rule key.
726-
rollout_id: The ID of the rollout to be searched if the experiment if from a rollout.
727-
728-
Returns:
729-
Optional[str]: The experiment ID if found, otherwise None.
730-
"""
731-
# Check a specific rollout (if provided)
732-
if rollout_id:
733-
rollout = self.get_rollout_from_id(rollout_id)
734-
if rollout:
735-
for experiment_data in rollout.experiments:
736-
rollout_experiment = entities.Experiment(**experiment_data)
737-
if rollout_experiment.key == key:
738-
return rollout_experiment.id
739-
740-
# Try getting the experiment from experiment_key_map
741-
if key:
742-
experiment = self.get_experiment_from_key(key)
743-
if experiment:
744-
return experiment.id
745-
746-
return None

0 commit comments

Comments
 (0)