From a1530fb9528addf4ae794cd4f84e95cd40457a97 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 2 May 2016 14:06:44 -0400 Subject: [PATCH] Update qbo_item.rb --- app/models/qbo_item.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/qbo_item.rb b/app/models/qbo_item.rb index d05da03..22ae322 100644 --- a/app/models/qbo_item.rb +++ b/app/models/qbo_item.rb @@ -19,8 +19,13 @@ class QboItem < ActiveRecord::Base end def self.sync - items = get_base.service.find_by(:type, "Service") - + #items = get_base.service.find_by(:type, "Service") + last = Qbo.first.last_sync + + query = "SELECT Id, Name FROM Item" + query << " WHERE Metadata.LastUpdatedTime>'#{last}' " if last + + items = get_base.service.query() transaction do # Update the item table items.each { |item| @@ -32,6 +37,6 @@ class QboItem < ActiveRecord::Base end #remove deleted items - where.not(items.map(&:id)).destroy_all + #where.not(items.map(&:id)).destroy_all end end