Skip to content

Conversation

joel
Copy link

@joel joel commented Dec 13, 2018

The report shows "Import completed: x updated" after the import regardless if there were updates or not, I find that quite confusing. I provide a workaround to get proper "Import completed: x update skipped". However the report needs to be revisited a bit because the rows skipped are marked as invalid, that is not represented the truth, you can add a custom logical during your import and skip some rows, that doesn't make them invalid, just omitted.

@joel joel force-pushed the skip-update-wo-changes branch from 1335019 to c165fb4 Compare December 13, 2018 19:42
@@ -633,8 +638,20 @@ class ImportUserCSVByFirstName
end

import.run!
expect(import.report.valid_rows.size).to eq(1)
Copy link
Author

@joel joel Dec 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really confusing, should have 2 valid rows. We defined a rule to skip the import or not, that doesn't make input values invalid, just make this import not suitable to go in. I mean no need to find out what is wrong with the CSV.

include ActiveModel::Model
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveModel::Dirty
Copy link
Author

@joel joel Dec 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it was hard to integrate dirty with virtus, switched to full AM

@@ -1,6 +1,6 @@
language: ruby
rvm:
- 2.3.0
- 2.5.3
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed by AM

@pcreux
Copy link
Owner

pcreux commented Jan 8, 2019

This is an interesting point. It'd be good to only count as updated records that's data has changed. skip currently means skip because invalid. We would indeed have to revisit the way we generate reports. I believe it could be something like: 2 created, 3 updated, 4 skipped, 1 invalid.

I'll think about it some more. This might introduce breaking changes.

@pcreux pcreux changed the base branch from master to main September 3, 2020 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants