class PetitionCountJob < ApplicationJob - PetitionCountJob has no descriptive comment
delegate :signature_count_interval, to: :Site
delegate :disable_invalid_signature_count_check?, to: :Site
queue_as :highest_priority
def perform(now = current_time)
return if disable_invalid_signature_count_check?
petitions.find_each do |petition|
unless petition.valid_signature_count!
ResetPetitionSignatureCountJob.perform_later(petition, now)
end
end
end
private
def current_time - PetitionCountJob#current_time doesn't depend on instance state (maybe move it to another class?)
Time.current.change(usec: 0).iso8601
end
def petitions - PetitionCountJob#petitions doesn't depend on instance state (maybe move it to another class?)
Petition.in_need_of_validating
end
end