Skip to content

Commit ad0e13c

Browse files
author
Varun Rathore
committed
Added fixes
1 parent 55f2a0a commit ad0e13c

File tree

2 files changed

+134
-109
lines changed

2 files changed

+134
-109
lines changed

firebase_admin/remote_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,19 @@ def evaluate_percent_condition(self, percent_condition,
377377
else:
378378
norm_percent_upper_bound = 0
379379
norm_percent_lower_bound = 0
380+
if micro_percent:
381+
norm_micro_percent = micro_percent
382+
else:
383+
norm_micro_percent = 0
380384
seed_prefix = f"{seed}." if seed else ""
381385
string_to_hash = f"{seed_prefix}{context.get('randomization_id')}"
382386

383387
hash64 = self.hash_seeded_randomization_id(string_to_hash)
384388
instance_micro_percentile = hash64 % (100 * 1000000)
385389
if percent_operator == PercentConditionOperator.LESS_OR_EQUAL:
386-
return instance_micro_percentile <= micro_percent
390+
return instance_micro_percentile <= norm_micro_percent
387391
if percent_operator == PercentConditionOperator.GREATER_THAN:
388-
return instance_micro_percentile > micro_percent
392+
return instance_micro_percentile > norm_micro_percent
389393
if percent_operator == PercentConditionOperator.BETWEEN:
390394
return norm_percent_lower_bound < instance_micro_percentile <= norm_percent_upper_bound
391395
logger.warning("Unknown percent operator: %s", percent_operator)

0 commit comments

Comments
 (0)