|
|
@ -162,10 +162,9 @@ class BulkImportService < BaseService
|
|
|
|
|
|
|
|
|
|
|
|
def import_lists!
|
|
|
|
def import_lists!
|
|
|
|
rows = @import.rows.to_a
|
|
|
|
rows = @import.rows.to_a
|
|
|
|
|
|
|
|
included_lists = rows.map { |row| row.data['list_name'] }.uniq
|
|
|
|
|
|
|
|
|
|
|
|
if @import.overwrite?
|
|
|
|
if @import.overwrite?
|
|
|
|
included_lists = rows.map { |row| row.data['list_name'] }.uniq
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@account.owned_lists.where.not(title: included_lists).destroy_all
|
|
|
|
@account.owned_lists.where.not(title: included_lists).destroy_all
|
|
|
|
|
|
|
|
|
|
|
|
# As list membership changes do not retroactively change timeline
|
|
|
|
# As list membership changes do not retroactively change timeline
|
|
|
@ -175,6 +174,10 @@ class BulkImportService < BaseService
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
included_lists.each do |title|
|
|
|
|
|
|
|
|
@account.owned_lists.find_or_create_by!(title: title)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
Import::RowWorker.push_bulk(rows) do |row|
|
|
|
|
Import::RowWorker.push_bulk(rows) do |row|
|
|
|
|
[row.id]
|
|
|
|
[row.id]
|
|
|
|
end
|
|
|
|
end
|
|
|
|