diff options
| author | stuppie | 2026-10-05 13:00:52 -0600 |
|---|---|---|
| committer | stuppie | 2026-10-05 13:00:52 -0600 |
| commit | f7d6c62ce0a02542f3ea2953ecb96a2900638934 (patch) | |
| tree | 4e9cba44cf314f5efb1ec14e0e7117c30f432a6f | |
| parent | c1ba00b7eb82540453a84fc4951a88ab9472b060 (diff) | |
| download | generalresearch-f7d6c62ce0a02542f3ea2953ecb96a2900638934.tar.gz generalresearch-f7d6c62ce0a02542f3ea2953ecb96a2900638934.zip | |
dont build balances for products with 0 txsv3.6.9
| -rw-r--r-- | generalresearch/models/thl/product.py | 16 | ||||
| -rw-r--r-- | pyproject.toml | 2 |
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" |
