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

Import: Missing name not caught when ID is also missing #2114

Open
richardolsson opened this issue Aug 28, 2024 · 1 comment · May be fixed by #2117
Open

Import: Missing name not caught when ID is also missing #2114

richardolsson opened this issue Aug 28, 2024 · 1 comment · May be fixed by #2117
Assignees
Labels
🐜 bug Something isn't working 🚪 entry-level Good for newcomers 🐬 Medium Just a nice sized issue.

Comments

@richardolsson
Copy link
Member

Description

There is error-checking in the importer that makes sure we don't try to import (or even validate on the server) rows that are invalid in some way. One such way is when we try to import a person which has no first name or last name. The same checks also warn against importing without an ID. But it seems that when you configure an import without an ID, the warning about missing ID obscures the deal-breaker error that should be displayed because there is no name.

Steps to reproduce

  1. Go to https://app.dev.zetkin.org/organize/1/people
  2. Click on "Create"
  3. Click on "Import people"
  4. Pick a file that contains names but not IDs (see example CSV below)
  5. Configure first name and last name column
  6. Click preview

Example CSV

FNAME,LNAME,EMAIL
Clara,Zetkin,[email protected]
Clara,,[email protected]

Expected Behaviour

A red error should be displayed (instead of the yellow warning) letting the user know that there is no ID or name on one row. Internally in the code, this problem is called ImportProblemKind.MISSING_ID_AND_NAME.

Actual Behaviour

A yellow warning about missing ID is displayed, but can be bypassed by the user (even though the import will fail on the next step).

Screenshots (if you have any)

Note how the HTTP request has failed, because the client tried to make the request even though it should have found that there was a missing name and stopped.

image

Proposed solution

Add a test case for this in predictProblems.spec.ts and tweak predictProblems() to catch the problem.

@richardolsson richardolsson added 🐜 bug Something isn't working 🚪 entry-level Good for newcomers 🐬 Medium Just a nice sized issue. labels Aug 28, 2024
@kaulfield23 kaulfield23 self-assigned this Sep 1, 2024
@kaulfield23
Copy link
Contributor

I will take this one!

@kaulfield23 kaulfield23 linked a pull request Sep 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐜 bug Something isn't working 🚪 entry-level Good for newcomers 🐬 Medium Just a nice sized issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants