tab/app/controllers/concerns/statistics.rb

20 lines
324 B
Ruby
Raw Normal View History

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