You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a file with the headers: supplier,sku,name,description,shipping,price,quantity_unit,minimum_quantity,maximum_quantity
After running in a before_batch_import callback, importer.batch_slice_columns(%w[supplier sku price minimum_quantity maximum_quantity])
the headers are sliced as expected.
However, if I wanted to further reduce the results set, calling importer.batch_slice_columns(%w[sku price minimum_quantity maximum_quantity])
does not reduce the csv_lines as expected due to @use_indexeshere referring to the original indices but not the resulting indices.
This ends up replacing the values unexpectedly (since it uses the indices in @use_indexes which may no longer apply to the sliced results).
Ideally, running batch_slice_columns multiple times would continually reduce the column set based on the results of the prior call.
The text was updated successfully, but these errors were encountered:
clinejj
changed the title
Cannot run batch_slice_columns multiple times
Calling batch_slice_columns multiple times results in unexpected behavior
Jan 5, 2021
Given a file with the headers:
supplier,sku,name,description,shipping,price,quantity_unit,minimum_quantity,maximum_quantity
After running in a before_batch_import callback,
importer.batch_slice_columns(%w[supplier sku price minimum_quantity maximum_quantity])
the headers are sliced as expected.
However, if I wanted to further reduce the results set, calling
importer.batch_slice_columns(%w[sku price minimum_quantity maximum_quantity])
does not reduce the
csv_lines
as expected due to@use_indexes
here referring to the original indices but not the resulting indices.This ends up replacing the values unexpectedly (since it uses the indices in
@use_indexes
which may no longer apply to the sliced results).Ideally, running batch_slice_columns multiple times would continually reduce the column set based on the results of the prior call.
The text was updated successfully, but these errors were encountered: