Fix syncing articles with non-import sync methods (#633)
This commit is contained in:
parent
d669edb173
commit
9283ed4f5e
3 changed files with 66 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue