-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(2931/4) Actual, Refund or Comment csv file import service #2304
(2931/4) Actual, Refund or Comment csv file import service #2304
Conversation
4963bbc
to
35c407b
Compare
35c407b
to
e396ddb
Compare
spec/models/import/row_error_spec.rb
Outdated
end | ||
end | ||
|
||
describe "#csv_row" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if this method was named csv_row_number
, to avoid confusion that it might refer to the CSV row being imported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this was named to be compatible with the existing importer and views - I've had to add it back in later! :(
e396ddb
to
b2a7544
Compare
We want to reuse this error class for the activity, refund and comment import process, but to do so it needs to support the existing interface so that we can be compatible whilst the importer is switched to the new one that is in progress. All we need is a representation of the row as it appears in the csv data file, the users expectation of the row number. This is just a matter of the enumerable index plus 2. Adding this method has no impact on existing code. We also add a test.
This class is relatively straight forward, it is responsible for taking the uploaded csv data and running through them to import the data. It relies on the classes created in previous work to do so, It is concerned with: - checking the required column headers are present - collating the objects that the rows become on import - collating any errors from the import process - rolling back the database if there are errors Co-authored-by:shuldt <suze@dxw.com>
b2a7544
to
99bdbee
Compare
Changes in this PR
This is the final part of the work to introduce a new Actual, Refund and Activity Comment import.
We update an existing
ErrorMessage
so it can be used by the new import and work the same way as the existing one so that we can run both with minimal effort.With the error class updated we go on to the final service object, this one is concerned with:
It uses the classes introduced in previous work.
The next step will be to introduce a feature flag and switch importers based on it, we may also improve the UI based on the new importer.
https://trello.com/c/lBZkYq5c