Skip to content
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

Merged

Conversation

shuldt
Copy link
Collaborator

@shuldt shuldt commented Jan 10, 2024

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:

  • 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

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

@shuldt shuldt force-pushed the feature/2931-actual-refund-comment-csv-file-import-service branch 3 times, most recently from 4963bbc to 35c407b Compare January 11, 2024 11:39
@mec mec changed the title Feature/2931 actual refund comment csv file import service (2931/4) Actual refund comment csv file import service Jan 15, 2024
@mec mec changed the title (2931/4) Actual refund comment csv file import service (2931/4) Actual, refund and activity comment csv file import service Jan 15, 2024
@mec mec changed the title (2931/4) Actual, refund and activity comment csv file import service (2931/4) Actual, refund or Comment csv file import service Jan 15, 2024
@mec mec changed the title (2931/4) Actual, refund or Comment csv file import service (2931/4) Actual, Refund or Comment csv file import service Jan 15, 2024
@mec mec force-pushed the feature/2931-actual-refund-comment-csv-file-import-service branch from 35c407b to e396ddb Compare January 15, 2024 13:00
@mec mec marked this pull request as ready for review January 15, 2024 14:04
@mec mec requested a review from CristinaRO January 15, 2024 15:32
end
end

describe "#csv_row" do
Copy link
Collaborator

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.

Copy link
Collaborator

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! :(

@mec mec force-pushed the feature/2931-actual-refund-comment-csv-file-import-service branch from e396ddb to b2a7544 Compare January 16, 2024 08:52
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>
@mec mec force-pushed the feature/2931-actual-refund-comment-csv-file-import-service branch from b2a7544 to 99bdbee Compare January 16, 2024 08:52
@mec mec merged commit d6a50e6 into develop Jan 16, 2024
3 checks passed
@mec mec deleted the feature/2931-actual-refund-comment-csv-file-import-service branch January 16, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants