class ResetPetitionSignatureCountJob < ApplicationJob - ResetPetitionSignatureCountJob has no descriptive comment
class InvalidSignatureCount < RuntimeError; end - ResetPetitionSignatureCountJob::InvalidSignatureCount has no descriptive comment
queue_as :highest_priority
def perform(petition, time = current_time)
petition.reset_signature_count!(time.in_time_zone)
send_notification(petition)
end
private
def current_time - ResetPetitionSignatureCountJob#current_time doesn't depend on instance state (maybe move it to another class?)
Time.current.change(usec: 0).iso8601
end
def send_notification(petition)
Appsignal.send_exception(exception(petition))
end
def exception(petition)
InvalidSignatureCount.new(error_message(petition))
end
def error_message(petition) - ResetPetitionSignatureCountJob#error_message doesn't depend on instance state (maybe move it to another class?)
I18n.t(:"invalid_signature_count", scope: :"petitions.errors", id: petition.id.to_s)
end
end