Skip to content

Commit f9101e9

Browse files
committed
Implement suggested comments
1 parent 70c281e commit f9101e9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

optimizely/decision_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ def get_variation_for_feature(
672672
- 'error': Boolean indicating if an error occurred during the decision process.
673673
- 'reasons': List of log messages representing decision making for the feature.
674674
"""
675-
holdouts = project_config.get_holdouts_for_flag(feature.id)
675+
holdouts = project_config.get_holdouts_for_flag(feature.key)
676676

677677
if holdouts:
678678
# Has holdouts - use get_decision_for_flag which checks holdouts first
@@ -708,7 +708,7 @@ def get_decision_for_flag(
708708
user_id = user_context.user_id
709709

710710
# Check holdouts
711-
holdouts = project_config.get_holdouts_for_flag(feature_flag.id)
711+
holdouts = project_config.get_holdouts_for_flag(feature_flag.key)
712712
for holdout in holdouts:
713713
holdout_decision = self.get_variation_for_holdout(holdout, user_context, project_config)
714714
reasons.extend(holdout_decision['reasons'])

optimizely/project_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,19 +834,19 @@ def get_flag_variation(
834834

835835
return None
836836

837-
def get_holdouts_for_flag(self, flag_id: str) -> list[HoldoutDict]:
837+
def get_holdouts_for_flag(self, flag_key: str) -> list[HoldoutDict]:
838838
""" Helper method to get holdouts from an applied feature flag.
839839
840840
Args:
841-
flag_id: (REQUIRED) ID of the feature flag.
841+
flag_key: Key of the feature flag.
842842
843843
Returns:
844844
The holdouts that apply for a specific flag.
845845
"""
846846
if not self.holdouts:
847847
return []
848848

849-
return self.flag_holdouts_map.get(flag_id, [])
849+
return self.flag_holdouts_map.get(flag_key, [])
850850

851851
def get_holdout(self, holdout_id: str) -> Optional[HoldoutDict]:
852852
""" Helper method to get holdout from holdout ID.

0 commit comments

Comments
 (0)