aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generalresearch/models/thl/product.py16
-rw-r--r--pyproject.toml2
2 files changed, 14 insertions, 4 deletions
diff --git a/generalresearch/models/thl/product.py b/generalresearch/models/thl/product.py
index 16288f6..2f95f0f 100644
--- a/generalresearch/models/thl/product.py
+++ b/generalresearch/models/thl/product.py
@@ -85,9 +85,7 @@ if TYPE_CHECKING:
PRODUCT_BALANCES_METRICS_CACHE_KEY = "metrics:product_balances"
-PRODUCT_USER_WALLET_BALANCES_METRICS_CACHE_KEY = (
- "metrics:product_user_wallet_balances"
-)
+PRODUCT_USER_WALLET_BALANCES_METRICS_CACHE_KEY = "metrics:product_user_wallet_balances"
# fmt: off
@@ -1165,6 +1163,7 @@ class Product(BaseModel, validate_assignment=True):
"If the df is empty, we can also assume that there should be no "
"transactions in the ledger."
)
+ return
df = df.set_index("time_idx")
@@ -1215,6 +1214,11 @@ class Product(BaseModel, validate_assignment=True):
filters=filters,
)
df = client.compute(collections=ddf, sync=True)
+ if df.empty:
+ LOG.warning(
+ f"Product({self.uuid=}).prebuild_private_balance empty dataframe"
+ )
+ return
s = df.set_index("time_idx").sum()
@@ -1267,6 +1271,12 @@ class Product(BaseModel, validate_assignment=True):
force_rr_latest=False,
)
user_wallet_df = client.compute(ddf, sync=True)
+ if user_wallet_df.empty:
+ LOG.warning(
+ f"Product({self.uuid=}).prebuild_user_wallet_balances empty dataframe"
+ )
+ return
+
result = ProductUserWalletBalances.from_pop_ledger(
input_data=user_wallet_df,
product_id=self.uuid,
diff --git a/pyproject.toml b/pyproject.toml
index e1d8824..53e4201 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "generalresearch"
-version = "3.6.8"
+version = "3.6.9"
description = "Python Utilities for General Research"
readme = "README.md"
requires-python = ">=3.14"