Skip to content

Commit 73adb6b

Browse files
authored
Merge pull request #20 from growthbook/fix/zero-value-evaluation
Fix zero value evaluation for _getOrigHashValue
2 parents c3f0284 + 6bd7585 commit 73adb6b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

growthbook/growthbook.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,20 +1148,19 @@ def get_all_results(self):
11481148
return self._assigned.copy()
11491149

11501150
def _getOrigHashValue(self, attr: str = None, fallbackAttr: str = None) -> Tuple[str, str]:
1151-
11521151
attr = attr or "id"
11531152
val = ""
11541153
if attr in self._attributes:
1155-
val = self._attributes[attr] or ""
1154+
val = "" if self._attributes[attr] is None else self._attributes[attr]
11561155
elif attr in self._user:
1157-
val = self._user[attr] or ""
1156+
val = "" if self._user[attr] is None else self._user[attr]
11581157

11591158
# If no match, try fallback
11601159
if (not val or val == "") and fallbackAttr and self.sticky_bucket_service:
11611160
if fallbackAttr in self._attributes:
1162-
val = self._attributes[fallbackAttr] or ""
1161+
val = "" if self._attributes[fallbackAttr] is None else self._attributes[fallbackAttr]
11631162
elif fallbackAttr in self._user:
1164-
val = self._user[fallbackAttr] or ""
1163+
val = "" if self._user[fallbackAttr] is None else self._user[fallbackAttr]
11651164

11661165
if not val or val != "":
11671166
attr = fallbackAttr

0 commit comments

Comments
 (0)