From 8d6ad7203f6f4595d00edabfe229e5ffcc076916 Mon Sep 17 00:00:00 2001 From: stuppie Date: Thu, 8 Oct 2026 15:11:52 -0600 Subject: fix prefetch_products call. comment out payouts and pop_financial from product manager update_cached_fields --- generalresearch/managers/thl/product.py | 10 ++++++---- generalresearch/models/gr/business.py | 2 +- generalresearch/models/gr/team.py | 2 +- pyproject.toml | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/generalresearch/managers/thl/product.py b/generalresearch/managers/thl/product.py index b81fc1d..aadb30b 100644 --- a/generalresearch/managers/thl/product.py +++ b/generalresearch/managers/thl/product.py @@ -40,12 +40,14 @@ logger = logging.getLogger() class ProductManager(PostgresManager): + # Commented out payouts and pop_financial. These are sometimes + # really big; we need to store only a summary or not at all. CACHED_FIELDS: frozenset[str] = frozenset( { "balance", "user_wallet_balance", - "payouts", - "pop_financial", + # "payouts", + # "pop_financial", "users_active_7d", "task_completes_7d", "balance_net_7d", @@ -55,8 +57,8 @@ class ProductManager(PostgresManager): { "balance", "user_wallet_balance", - "payouts", - "pop_financial", + # "payouts", + # "pop_financial", } ) diff --git a/generalresearch/models/gr/business.py b/generalresearch/models/gr/business.py index 2104650..5ed85f2 100644 --- a/generalresearch/models/gr/business.py +++ b/generalresearch/models/gr/business.py @@ -286,7 +286,7 @@ class Business(BaseModel): :return: All the Products for this Business """ - self.products = product_manager.fetch_uuids(business_uuids=[self.uuid]) + self.products = product_manager.filter_paginated(business_uuids=[self.uuid]) def prefetch_bank_accounts( self, business_bank_account_manager: BusinessBankAccountManager diff --git a/generalresearch/models/gr/team.py b/generalresearch/models/gr/team.py index 8d23bc5..217f184 100644 --- a/generalresearch/models/gr/team.py +++ b/generalresearch/models/gr/team.py @@ -136,7 +136,7 @@ class Team(BaseModel): self.businesses = gr_business_manager.get_by_team(team_id=self.id) def prefetch_products(self, product_manager: ProductManager) -> None: - self.products = product_manager.fetch_uuids(team_uuids=[self.uuid]) + self.products = product_manager.filter_paginated(team_uuids=[self.uuid]) # --- Prebuild Methods --- diff --git a/pyproject.toml b/pyproject.toml index 957c120..08ed683 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "generalresearch" -version = "3.7.3" +version = "3.7.4" description = "Python Utilities for General Research" readme = "README.md" requires-python = ">=3.14" -- cgit v1.2.3