From 33bca902f5e6e4e8e16439e3cc851650dec08143 Mon Sep 17 00:00:00 2001 From: IJ Kim Date: Sat, 4 Jun 2016 09:54:30 -0400 Subject: [PATCH] fixed invalid query to Salesforce when there is no record --- lib/sf/account.rb | 8 ++++++-- lib/sf/version.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/sf/account.rb b/lib/sf/account.rb index 4c94abb..b0f01dc 100644 --- a/lib/sf/account.rb +++ b/lib/sf/account.rb @@ -100,8 +100,12 @@ def self.inc_parts_to_be def self.inc_certs_to_be acct_ids = Sf::Opportunity.cert_subscribers(Date.today.prev_month(2)).map(&:AccountId) - accts_str = acct_ids.map{|v| "\'#{v}\'"}.join(', ') - build_collection Sf.client.query("select #{FIELDS_SELECT_STR} from Account where InCommon_Participant__c = true and Id in (#{accts_str})") + if acct_ids.empty? + [] + else + accts_str = acct_ids.map{|v| "\'#{v}\'"}.join(', ') + build_collection Sf.client.query("select #{FIELDS_SELECT_STR} from Account where InCommon_Participant__c = true and Id in (#{accts_str})") + end end def self.active_inc_parts(service_name) diff --git a/lib/sf/version.rb b/lib/sf/version.rb index 19006a4..c9b0267 100644 --- a/lib/sf/version.rb +++ b/lib/sf/version.rb @@ -1,3 +1,3 @@ module Sf - VERSION = "0.1.34" + VERSION = "0.1.35" end