@property
    @memoized
    def plan(self):
        plan_version, subscription = Subscription.get_subscribed_plan_by_domain(self.domain_object)
        date_end = None
        next_subscription = {
            'exists': False,
            'can_renew': False,
            'name': None,
            'price': None,
        }
        cards = None
        if subscription:
            cards = get_customer_cards(self.account, self.request.user.username, self.domain)
            date_end = (subscription.date_end.strftime(USER_DATE_FORMAT)
                        if subscription.date_end is not None else "--")

            if subscription.date_end is not None:
                if subscription.is_renewed:

                    next_product = self.get_product_summary(subscription.next_subscription.plan_version,
                                                             self.account,
                                                             subscription)

                    next_subscription.update({
                        'exists': True,
                        'date_start': subscription.next_subscription.date_start.strftime(USER_DATE_FORMAT),
                        'name': subscription.next_subscription.plan_version.plan.name,
                        'price': next_product['monthly_fee'],
                    })

                else:
                    days_left = (subscription.date_end - datetime.date.today()).days
                    next_subscription.update({
                        'can_renew': days_left <= 30,
                        'renew_url': reverse(SubscriptionRenewalView.urlname, args=[self.domain]),
                    })

        info = {
            'products': [self.get_product_summary(plan_version, self.account, subscription)],
            'features': self.get_feature_summary(plan_version, self.account, subscription),
            'general_credit': self._fmt_credit(self._credit_grand_total(
                CreditLine.get_credits_by_subscription_and_features(
                    subscription
                ) if subscription else None
            )),
            'account_general_credit': self._fmt_credit(self._credit_grand_total(
                CreditLine.get_credits_for_account(
                    self.account
                ) if self.account else None
            )),
            'css_class': plan_version.plan.edition.lower() % "label-plan label-plan-%s",
            'do_not_invoice': subscription.do_not_invoice if subscription is not None else False,
            'is_trial': subscription.is_trial if subscription is not None else False,
            'date_start': (subscription.date_start.strftime(USER_DATE_FORMAT)
                           if subscription is not None else None),
            'date_end': date_end,
            'cards': cards,
            'next_subscription': next_subscription,
        }
        info['has_account_level_credit'] = (
            any(
                product_info['account_credit'] and product_info['account_credit']['is_visible']
                for product_info in info['products']
            )
            or info['account_general_credit'] and info['account_general_credit']['is_visible']
        )
        info.update(plan_version.user_facing_description)

        return info
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/domain/views.py/DomainSubscriptionView.plan/swapped operands of `%`