tab/app/controllers/concerns/statistics.rb

20 lines
324 B
Ruby
Raw Normal View History

2015-09-11 18:04:45 +02:00
class Statistics < Rails::Application
def shameful_users
User.where('balance > :amount', amount: config.shameful_balance)
2015-09-11 23:32:38 +02:00
.order(balance: :desc)
end
def total_debt
User.where.not(id: User.zeus).where('balance > 0').sum(:balance)
2015-09-11 18:04:45 +02:00
end
private
def zeus_balance
User.zeus.balance
end
end