Update and connect to drone #1
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
class Member < ApplicationRecord
|
class Member < ApplicationRecord
|
||||||
has_many :incomes
|
has_many :incomes, dependent: :destroy
|
||||||
|
|
||||||
def income
|
def income
|
||||||
incomes.sum(&:amount)
|
incomes.sum(&:amount)
|
||||||
|
@ -15,6 +15,8 @@ class Member < ApplicationRecord
|
||||||
|
|
||||||
def burden_percent
|
def burden_percent
|
||||||
((Income.total - others_included_income) / Income.total).round(2)
|
((Income.total - others_included_income) / Income.total).round(2)
|
||||||
|
rescue
|
||||||
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
def burden_amount(total_amount: Expense.monthly_total)
|
def burden_amount(total_amount: Expense.monthly_total)
|
||||||
|
|
Loading…
Reference in a new issue