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

Not showing rows imported (always defaulting to 0 on 'Review Import' page) #72

Open
HeadStudios opened this issue Jul 6, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@HeadStudios
Copy link

Hi,

After doing an import it is showing me 0 rows were imported - even though the Contact has been entered correctly.

Image 2023-07-06 at 7 41 28 pm

Video for context:
https://share.getcloudapp.com/04uv2xre

Any tips you can recommend for me?

@philsturgeon
Copy link

I am having the same problem. Data looks good, then it shows 0 out of 1 imported. Show failures doesn't show anything.

Screenshot 2023-07-11 at 1 42 53 PM Screenshot 2023-07-11 at 1 42 58 PM

@philsturgeon
Copy link

Looking at the logs, the config file is:

{
    "original_filename": "GIS Tree Import.csv",
    "uploaded_at": 1689080700,
    "values": null,
    "modifiers": [],
    "meta": {
        "file": "decf23b0c7fe1695a67654c46ad674d1.txt",
        "file_name": "decf23b0c7fe1695a67654c46ad674d1",
        "original_file": "GIS Tree Import.csv",
        "original_file_name": "GIS Tree Import"
    },
    "resource": "units",
    "mappings": {
        "unit_type": "unit_type",
        "coordinates-latitude": "latitude",
        "coordinates-longitude": "longitude",
        "specie": "species",
        "site": "site",
        "supervisor": "supervisor",
        "planted_on": "planted_on"
    }
}

and the failures are:

{
    "total_rows": 1,
    "imported": 0,
    "failures": [
        {
            "row": 2,
            "attribute": "three_words",
            "errors": [
                "validation.required"
            ],
            "values": {
                "unit_type": "tree",
                "coordinates-latitude": 56.530453,
                "coordinates-longitude": -5.982582,
                "specie": 1,
                "site": 1,
                "supervisor": 1,
                "planted_on": "2021-04-13 14:35"
            }
        }
    ],
    "errors": []
}

but thats not showing in the UI.

@philsturgeon
Copy link

use App\Nova\Fields\PartOfPointField;

// ...
            PartOfPointField::make('Latitude', 'coordinates', 'latitude')
                ->step('0.000001')
                ->onlyOnForms()
                ->rules('required'),

            PartOfPointField::make('Longitude', 'coordinates', 'longitude')
                ->step('0.000001')
                ->onlyOnForms()
                ->rules('required'),

Then its getting upset those fields dont exist in the database.

   Illuminate\Database\QueryException  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'coordinates-latitude' in 'field list' (SQL: insert into `units` (`unit_type`, `coordinates-latitude`, `coordinates-longitude`, `specie`, `site`, `supervisor`, `planted_on`, `uuid`, `updated_at`, `created_at`) values (tree, 56.530453, -5.982582, 1, 1, 1, 2021-04-13 14:35:00, 999efd75-c97f-46c6-baff-96c7214499f6, 2023-07-11 13:16:02, 2023-07-11 13:16:02)).

@simonhamp
Copy link
Owner

@HeadStudios @philsturgeon it's going to be most helpful if each of you could provide the full context of the relevant Models, Migrations, and Resources here so that I can see what your DB is looking like and how Nova sees things

Right now I can't tell enough to be able to dig into what's going on here, not without a lot more poking around on my end

@simonhamp simonhamp self-assigned this Jul 13, 2023
@simonhamp simonhamp added the bug Something isn't working label Jul 13, 2023
@simonhamp
Copy link
Owner

@philsturgeon you should be able to see errors now with v0.7.0

@superuser-me
Copy link

@HeadStudios Off topic!,
I'm new to laravel nova,
How can we add this custom buttons in nova what it's called?
Thank you.
CleanShot 2023-11-03 at 06 27 29 PM@2x

@HeadStudios
Copy link
Author

Any update on this? I thought I fixed it but it seems I'm back to not being able to import again and getting the same error.

@superuser-me you should be able to use a No va detached action or something along those lines for those buttons

@sulfanoaf-samba
Copy link

sulfanoaf-samba commented Jul 18, 2024

hi @simonhamp
we are facing the same problem with @philsturgeon

somehow after import the csv
some data are failure, this is expected
but the Show failures button not working

if the Show failures button clicked, on the browser console will display

TypeError: Cannot read properties of undefined (reading 'name')
    at laravel-nova-csv-import:2:32995
    at mo (runtime-core.esm-bundler.js:2918:18)
    at laravel-nova-csv-import:2:32848
    at mo (runtime-core.esm-bundler.js:2897:16)
    at laravel-nova-csv-import:2:31449
    at mo (runtime-core.esm-bundler.js:2918:18)
    at laravel-nova-csv-import:2:31278
    at r (runtime-core.esm-bundler.js:814:13)
    at vo (runtime-core.esm-bundler.js:2966:53)
    at Proxy.<anonymous> (nova-back-navigation:1:1572)

we need to refresh the browser multiple times untul Show failures button works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants