From a5cf46ef0c081b80a15b90e21c1f1ce6e629760a Mon Sep 17 00:00:00 2001 From: chrisjsimpson Date: Sun, 10 Mar 2024 13:49:09 +0000 Subject: [PATCH] Fix #1317 As a subscriber I can't see old archived plans which don't have a pricelist attached --- subscribie/__init__.py | 6 ++++-- subscribie/models.py | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/subscribie/__init__.py b/subscribie/__init__.py index b985a02e..f245d919 100644 --- a/subscribie/__init__.py +++ b/subscribie/__init__.py @@ -206,8 +206,10 @@ def start_session(): log.debug( f"Created PriceList with zero rules for currency {currency}" ) - # Ensure every plan has a PriceList attached for each supported currency - plans = Plan.query.all() + # Ensure every plan (including archived) has a PriceList attached + # for each supported currency + # https://github.com/Subscribie/subscribie/issues/1317 + plans = Plan.query.execution_options(include_archived=True).all() price_lists = ( PriceList.query.all() ) # TODO only get default pricelist for given currency diff --git a/subscribie/models.py b/subscribie/models.py index 9952bad6..15acb012 100644 --- a/subscribie/models.py +++ b/subscribie/models.py @@ -669,7 +669,6 @@ def __getattribute__(self, name): """ if super(Plan, self).__getattribute__(name) is None: log.warning(f"trial_period_days is none for plan {self.title}") - breakpoint() return super(Plan, self).__getattribute__(name) or 0 return super(Plan, self).__getattribute__(name)