Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
included reg_items in the checkin query
ij committed Mar 15, 2017
1 parent bf3f032 commit c7e8d53
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/sf/reg_registration.rb
@@ -135,31 +135,31 @@ def self.all_processed(code)
def self.all_checked_in(code)
where_stmt = "event_code__c = \'#{code}\' and check_in_at__c != null"
order_stmt = self.order_by(last_name__c: "ASC")
self.query(where_stmt, order_stmt)
self.query_with_reg_item_codes(where_stmt, order_stmt)
end

def self.not_checked_in(code)
where_stmt = "event_code__c = \'#{code}\' and status__c = \'processed\' and check_in_at__c = null"
order_stmt = self.order_by(last_name__c: "ASC")
self.query(where_stmt, order_stmt)
self.query_with_reg_item_codes(where_stmt, order_stmt)
end

def self.not_checked_in_a_to_i(code)
where_stmt = "event_code__c = \'#{code}\' and status__c = \'processed\' and check_in_at__c = null and last_name__c < \'J\'"
order_stmt = self.order_by(last_name__c: "ASC")
self.query(where_stmt, order_stmt)
self.query_with_reg_item_codes(where_stmt, order_stmt)
end

def self.not_checked_in_j_to_r(code)
where_stmt = "event_code__c = \'#{code}\' and status__c = \'processed\' and check_in_at__c = null and last_name__c > \'J\' and last_name__c < \'S\'"
order_stmt = self.order_by(last_name__c: "ASC")
self.query(where_stmt, order_stmt)
self.query_with_reg_item_codes(where_stmt, order_stmt)
end

def self.not_checked_in_s_to_z(code)
where_stmt = "event_code__c = \'#{code}\' and status__c = \'processed\' and check_in_at__c = null and last_name__c > \'S\'"
order_stmt = self.order_by(last_name__c: "ASC")
self.query(where_stmt, order_stmt)
self.query_with_reg_item_codes(where_stmt, order_stmt)
end

def self.where(args = {})
@@ -172,6 +172,12 @@ def self.order_by(args = {})
"ORDER BY #{orders}"
end

def self.query_with_reg_item_codes(where_stmt, order_stmt)
reg_item_select = "select code__c, reg_rate_code__c from reg_items__r"
sobjects = Sf.client.query("select Id, #{FIELDS_SELECT_STR}, (#{reg_item_select}) from RegRegistration__c where #{where_stmt} #{order_stmt}")
build_collection sobjects unless sobjects.blank?
end

def self.query(where_stmt, order_stmt)
sobjects = Sf.client.query("select Id, #{FIELDS_SELECT_STR} from RegRegistration__c where #{where_stmt} #{order_stmt}")
build_collection sobjects unless sobjects.blank?
2 changes: 1 addition & 1 deletion lib/sf/version.rb
@@ -1,3 +1,3 @@
module Sf
VERSION = "0.1.45"
VERSION = "0.1.46"
end

0 comments on commit c7e8d53

Please sign in to comment.