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