Updated

app/jobs / petition_count_job.rb

A
26 lines of codes
3 methods
4.0 complexity/method
10 churn
11.87 complexity
0 duplications
class PetitionCountJob < ApplicationJob
  1. 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
  1. PetitionCountJob#current_time doesn't depend on instance state (maybe move it to another class?)
Time.current.change(usec: 0).iso8601 end def petitions
  1. PetitionCountJob#petitions doesn't depend on instance state (maybe move it to another class?)
Petition.in_need_of_validating end end