2024-09-03 15:37:45 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Reviewable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2024-09-20 08:51:37 +00:00
|
|
|
included do
|
|
|
|
scope :reviewed, -> { where.not(reviewed_at: nil) }
|
|
|
|
scope :unreviewed, -> { where(reviewed_at: nil) }
|
|
|
|
end
|
|
|
|
|
2024-09-03 15:37:45 +00: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
|