Skip to content

Commit

Permalink
updated session.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
ij committed Aug 21, 2014
1 parent 493fe96 commit 3f90cd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions lib/sf/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,24 @@ def ready_to_publish?
ready
end

def <=>(b)
if self.start_time__c.present? and b.start_time__c.present?
self.start_time__c <=> b.start_time__c
else
0
end
end

def self.by_event_code(code)
event = Sf::RegEvent.find_by(code__c: code)
self.where(event__c: event.Id) unless event.blank?
end

def self.unpublished_by_event_code(code)
event = Sf::RegEvent.find_by(code__c: code)
self.where(event__c: event.Id, cms_session_id__c: '') unless event.blank?
end

def self.where(args = {})
where = args.map {|k,v| "#{k} = \'#{v}\'"}.join(" and ")
sobjects = Sf.client.query("select Id, Name, title__c, primary_track_id__r.Name, session_type__r.Name, start_time__c, room_id__r.Name, cms_session_id__c, timestamp__c, date__c, end_time__c from EventSession__c where #{where}")
Expand Down
2 changes: 1 addition & 1 deletion lib/sf/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Sf
VERSION = "0.1.6"
VERSION = "0.1.7"
end

0 comments on commit 3f90cd7

Please sign in to comment.