Untitled

mail@pastecode.io avatar
unknown
ruby
2 years ago
211 B
4
Indexable
Never

daily_spent
  Post.where("collected_at BETWEEN ? AND ?", Time.current.beginning_of_day, Time.current.end_of_day).map { |i| i.credit_cost }.sum
end

def credit_cost
  (batch_small * 3) + (batch_large * 30)
end