tab/app/controllers/concerns/statistics.rb
2015-09-11 23:32:38 +02:00

19 lines
324 B
Ruby

class Statistics < Rails::Application
def shameful_users
User.where('balance > :amount', amount: config.shameful_balance)
.order(balance: :desc)
end
def total_debt
User.where.not(id: User.zeus).where('balance > 0').sum(:balance)
end
private
def zeus_balance
User.zeus.balance
end
end