Skip to content

Instantly share code, notes, and snippets.

@jfeldstein
Created July 9, 2015 23:21
Show Gist options
  • Save jfeldstein/857225d985ef9ffda6f7 to your computer and use it in GitHub Desktop.
Save jfeldstein/857225d985ef9ffda6f7 to your computer and use it in GitHub Desktop.
SET Campaign: Should Pull? Logic as of 7/9/15
# "LegacyCampaign" is what Super Sonic calls SET campaigns
class LegacyCampaign < ActiveRecord::Base
def self.should_pull(campaign)
vintage = self.is_good_vintage(campaign)
is_a_test = self.is_a_test(campaign)
# Special cases:
nhs_force = (campaign.company.master_branch.try(:name)=='NHS')
return false if is_a_test
return true if vintage || nhs_force
end
def self.is_good_vintage(campaign)
# For K&N: Skip anythign before 06/15
if campaign.company.name == 'KN'
return false if campaign.ts_created_at.nil? || campaign.ts_created_at < Date.parse("June 01, 2015")
end
# Allow anything following the nice convention.
(2014..2025).any? {|year| campaign.name[year.to_s] }
end
def self.is_a_test(campaign)
(campaign.name.downcase["test"]!=nil) || (campaign.name.downcase["csap"]!=nil)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment