-
Notifications
You must be signed in to change notification settings - Fork 67
Auto Skip Update Without Changes #78
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
base: main
Are you sure you want to change the base?
Conversation
1335019
to
c165fb4
Compare
@@ -633,8 +638,20 @@ class ImportUserCSVByFirstName | |||
end | |||
|
|||
import.run! | |||
expect(import.report.valid_rows.size).to eq(1) |
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.
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 |
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.
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 |
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.
Needed by AM
This is an interesting point. It'd be good to only count as updated records that's data has changed. I'll think about it some more. This might introduce breaking changes. |
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.