|
|
|
@ -18,9 +18,11 @@ class Movie < ApplicationRecord
|
|
|
|
|
def flop?
|
|
|
|
|
total_gross.blank? || total_gross < 225_000_000
|
|
|
|
|
end
|
|
|
|
|
def self.released
|
|
|
|
|
where("released_on < ?", Time.now).order(released_on: :desc)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scope :released, -> { where("released_on < ?", Time.now).order("released_on desc") }
|
|
|
|
|
scope :upcoming, -> { where("released_on > ?", Time.now).order("released_on asc") }
|
|
|
|
|
scope :recent, ->(max=5) { released.limit(max) }
|
|
|
|
|
|
|
|
|
|
def average_stars
|
|
|
|
|
reviews.average(:stars) || 0.0
|
|
|
|
|
end
|
|
|
|
|