Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added RegEvent#active_since_past_year
ij committed Oct 5, 2022
1 parent 8228720 commit 56cc729
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/sf/reg_event.rb
@@ -48,6 +48,13 @@ def self.by_codes(codes = [])
sobjects.blank? ? [] : build_collection(sobjects)
end

def self.active_since_past_year
year_ago = Time.now.years_ago(1).iso8601
where = "status__c = 'active' and end_date__c > #{year_ago}"
sobjects = Sf.client.query("select #{FIELDS_SELECT_STR} from RegEvent__c where #{where}")
sobjects.blank? ? [] : build_collection(sobjects)
end

def self.create_from_event(event)
return if event.nil? || event.id.nil? || !event.instance_of?(Event)

2 changes: 1 addition & 1 deletion lib/sf/version.rb
@@ -1,3 +1,3 @@
module Sf
VERSION = "0.1.70"
VERSION = "0.1.71"
end

0 comments on commit 56cc729

Please sign in to comment.