Skip to content

Commit 6bd7585

Browse files
committed
Fix zero value evaluation for _getOrigHashValue
1 parent 01823ef commit 6bd7585

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Static type checking with MyPy
3636
run: |
37-
mypy growthbook.py --implicit-optional
37+
mypy growthbook/growthbook.py --implicit-optional
3838
3939
- name: Test with pytest
4040
run: |

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)