|
1class ResetPetitionSignatureCountJob < ApplicationJob
|
|
2 class InvalidSignatureCount < RuntimeError; end
|
|
|
|
4 queue_as :highest_priority
|
|
|
|
6 def perform(petition, time = current_time)
|
|
7 petition.reset_signature_count!(time.in_time_zone)
|
|
8 send_notification(petition)
|
|
|
|
|
|
|
|
|
- UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
- Complexity 1 » saikuro
|
|
|
14 Time.current.change(usec: 0).iso8601
|
|
|
|
|
|
17 def send_notification(petition)
|
|
18 Appsignal.send_exception(exception(petition))
|
|
|
|
|
|
21 def exception(petition)
|
|
22 InvalidSignatureCount.new(error_message(petition))
|
|
|
|
|
- UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
- Complexity 1 » saikuro
|
25 def error_message(petition)
|
|
26 I18n.t(:"invalid_signature_count", scope: :"petitions.errors", id: petition.id.to_s)
|
|
|
|
|