|
1class StopPetitionsEarlyJob < ApplicationJob
|
|
2 queue_as :high_priority
|
|
|
|
|
|
|
|
6 set(wait_until: time).perform_later(time.iso8601)
|
|
|
|
|
|
|
- FeatureEnvy - refers to 'petition' more than self (maybe move it to another class?) » reek
- Complexity 3 » saikuro
|
|
|
11 time = time.in_time_zone
|
|
12 cutoff_time = Parliament.notification_cutoff_at
|
|
|
|
14 Petition.in_need_of_stopping.find_each do |petition|
|
|
15 if petition.created_at >= cutoff_time
|
|
16 send_notification(petition)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- DuplicateMethodCall - calls 'petition.creator' 2 times » reek
- UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
- Complexity 4 » saikuro
|
25 def send_notification(petition)
|
|
26 unless petition.special_consideration?
|
- Case statement is missing an else clause. » roodi
|
|
|
28 when Petition::VALIDATED_STATE
|
|
29 NotifyCreatorOfValidatedPetitionBeingStoppedJob.perform_later(petition.creator)
|
|
30 when Petition::SPONSORED_STATE
|
|
31 NotifyCreatorOfSponsoredPetitionBeingStoppedJob.perform_later(petition.creator)
|
|
|
|
|
|
|
|
|