Hack together a quick dashboard

Also fix bug in member calc
This commit is contained in:
Andrew Tomaka 2023-02-23 21:46:05 -05:00
parent 8a7a0cc720
commit bebdd5e30d
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
4 changed files with 82 additions and 4 deletions

View file

@ -10,14 +10,14 @@ class Member < ApplicationRecord
end
def others_included_income
Income.where(included: true) - included_income
Income.where(included: true).sum(&:amount) - included_income
end
def burden_percent
(Income.total - others_included_income) / Income.total
((Income.total - others_included_income) / Income.total).round(2)
end
def burden_amount
burden_percent * Expense.total
burden_percent * Expense.all.map(&:monthly).sum.round(2)
end
end