Hack together a quick dashboard
Also fix bug in member calc
This commit is contained in:
parent
8a7a0cc720
commit
bebdd5e30d
4 changed files with 82 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue