Fix syncing articles with non-import sync methods (#633)

This commit is contained in:
wvengen 2019-03-23 18:31:22 +01:00
parent d669edb173
commit 9283ed4f5e
3 changed files with 66 additions and 2 deletions

View file

@ -29,7 +29,7 @@ class SharedSupplier < ApplicationRecord
def shared_sync_methods
methods = []
methods += %w(all_available all_unavailable) if shared_articles.count < FoodsoftConfig[:shared_supplier_article_sync_limit]
methods += %w(import) # perhaps, in the future: if shared_articles.count > 20
methods += %w(import)
methods
end
end

View file

@ -55,7 +55,7 @@ class Supplier < ApplicationRecord
unless shared_sync_method == 'import'
shared_supplier
.shared_articles
.where.not(id: existing_articles)
.where.not(id: existing_articles.to_a)
.each { |shared_article| new_articles << shared_article.build_new_article(self) }
end
return [updated_article_pairs, outlisted_articles, new_articles]