From 3a5ea33cddf8a46a65d05c6bba19e1d5a6a7f2d8 Mon Sep 17 00:00:00 2001 From: IJ Kim Date: Thu, 3 Sep 2015 00:21:35 -0400 Subject: [PATCH] removed nil error when there is no participants to be --- 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 bbe6679..2c5f4ab 100644 --- a/lib/sf/account.rb +++ b/lib/sf/account.rb @@ -90,8 +90,12 @@ def self.intl_partner?(account_id) # It looks up for the past one year def self.inc_parts_to_be acct_ids = Sf::Opportunity.inc_participations(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.inc_certs_to_be diff --git a/lib/sf/version.rb b/lib/sf/version.rb index 7f61923..ff5761b 100644 --- a/lib/sf/version.rb +++ b/lib/sf/version.rb @@ -1,3 +1,3 @@ module Sf - VERSION = "0.1.26" + VERSION = "0.1.27" end