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

Display errors taking place during import partner process #4707

Merged
merged 10 commits into from
Oct 22, 2024

Conversation

jp524
Copy link
Contributor

@jp524 jp524 commented Oct 5, 2024

Resolves #4688

Description

In order to display a message when a partner import is failing I modified the existing Importable concern and the Partner model import_csv method. This ensures that any validation error (invalid email, name already taken, etc.) gets passed along to be displayed.

The message shown to the user is more specific than the one asked in the issue, but I think it makes sense to display the exact error to the user in order for them to easily fix it.

On a technical note: I chose to modify all import_csv methods to return nil if there's no error, or otherwise return an errors array. I'm open to suggestions if there's a better way to do this.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added some requests tests for Partners, and ensured that tests for other models using import_csv (DonationSites, StorageLocation, ProductDriveParticipants, Vendors) were still passing.

Screenshots

Successful import
import success

Import with errors
import errors

cielf
cielf previously requested changes Oct 6, 2024
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

A quick thing I notice from your screenshot is that the errors are being displayed as a notice. Please display them as an error instead.

@jp524
Copy link
Contributor Author

jp524 commented Oct 6, 2024

A quick thing I notice from your screenshot is that the errors are being displayed as a notice. Please display them as an error instead.

Thanks for catching that @cielf! It's been changed:
Screenshot 2024-10-06 at 16 14 25

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Works well for the partner import.
It's pointing out that we need to do some work on the donation site import -- because it is also not informing of errors. But/and we should expand that to cover more fields, so I think it can be a separate issue.

@cielf cielf requested a review from dorner October 10, 2024 18:19
@cielf cielf dismissed their stale review October 10, 2024 18:20

Addressed

@cielf
Copy link
Collaborator

cielf commented Oct 10, 2024

Passing to @dorner for technical review.

app/controllers/concerns/importable.rb Outdated Show resolved Hide resolved
@jp524 jp524 requested a review from dorner October 14, 2024 22:33
app/models/concerns/provideable.rb Outdated Show resolved Hide resolved
app/models/partner.rb Outdated Show resolved Hide resolved
app/models/donation_site.rb Outdated Show resolved Hide resolved
@jp524 jp524 requested a review from dorner October 16, 2024 22:44
@dorner
Copy link
Collaborator

dorner commented Oct 22, 2024

All good, thanks!

@dorner dorner merged commit c1fec92 into rubyforgood:main Oct 22, 2024
11 checks passed
@jp524 jp524 deleted the warning-failed-partner-import branch October 22, 2024 13:55
Copy link
Contributor

@jp524: Your PR Display errors taking place during import partner process is part of today's Human Essentials production release: 2024.10.27.
Thank you very much for your contribution!

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