2024-09-04 01:37:45 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Reviewable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2024-09-20 18:51:37 +10:00
|
|
|
included do
|
|
|
|
scope :reviewed, -> { where.not(reviewed_at: nil) }
|
|
|
|
scope :unreviewed, -> { where(reviewed_at: nil) }
|
|
|
|
end
|
|
|
|
|
2024-09-04 01:37:45 +10:00
|
|
|
def requires_review?
|
|
|
|
reviewed_at.nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def reviewed?
|
|
|
|
reviewed_at.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def requested_review?
|
|
|
|
requested_review_at.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def requires_review_notification?
|
|
|
|
requires_review? && !requested_review?
|
|
|
|
end
|
|
|
|
end
|