mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update qbo_item.rb
This commit is contained in:
@@ -21,6 +21,8 @@ class QboItem < ActiveRecord::Base
|
|||||||
def self.sync
|
def self.sync
|
||||||
last = Qbo.first.last_sync
|
last = Qbo.first.last_sync
|
||||||
|
|
||||||
|
QboItem.delete_all
|
||||||
|
|
||||||
query = "SELECT Id, Name FROM Item "
|
query = "SELECT Id, Name FROM Item "
|
||||||
query << " WHERE Type = 'Service' "
|
query << " WHERE Type = 'Service' "
|
||||||
#query << " AND Metadata.LastUpdatedTime > '#{last}' " if last
|
#query << " AND Metadata.LastUpdatedTime > '#{last}' " if last
|
||||||
@@ -34,9 +36,9 @@ class QboItem < ActiveRecord::Base
|
|||||||
qbo_item.id = item.id
|
qbo_item.id = item.id
|
||||||
qbo_item.save
|
qbo_item.save
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
#remove deleted items
|
QboItem.where.not(items.map(&:id)).destroy_all
|
||||||
QboItem.where.not(items.map(&:id)).destroy_all
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user