From 1620d56e2db5df73e5fa8f670968480728f692d1 Mon Sep 17 00:00:00 2001 From: Josh Pigford Date: Mon, 3 Feb 2025 09:04:39 -0600 Subject: [PATCH] Allow connecting a few accounts before upgrade prompt --- app/controllers/application_controller.rb | 1 + app/models/family.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3643c9c7..7c9e98ca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base return false unless Current.session return false if Current.family.subscribed? return false if subscription_pending? || request.path == settings_billing_path + return false if Current.family.active_accounts_count <= 3 true end diff --git a/app/models/family.rb b/app/models/family.rb index 329f8e3f..9a277f43 100644 --- a/app/models/family.rb +++ b/app/models/family.rb @@ -209,6 +209,10 @@ class Family < ApplicationRecord entries.order(:date).first&.date || Date.current end + def active_accounts_count + accounts.active.count + end + private CategoriesWithTotals = Struct.new(:total_money, :category_totals, keyword_init: true) CategoryWithStats = Struct.new(:category, :amount_money, :percentage, keyword_init: true)