Add extra bills tracking

This commit is contained in:
Andrew Tomaka 2023-02-24 19:08:12 -05:00
parent a21639ff6f
commit 63487a9cba
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
22 changed files with 353 additions and 3 deletions

View file

@ -14,4 +14,12 @@ class Expense < ApplicationRecord
def self.total
Expense.sum(&:payment)
end
def self.monthly_total
Expense.all.map(&:monthly).sum.round(2)
end
def self.autopaid_total
Expense.where(autopaid: true).map(&:monthly).sum.round(2)
end
end