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

#2514 Importing a community curated list leads to an error #2595

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

djstini
Copy link
Contributor

@djstini djstini commented Aug 28, 2023

This adds error Handling for missing food-keys in the open_data_importer slug_id_cache and consequently solves the Bug that caused imports of OpenData lists to fail.

Related Issue is #2514

@vabene1111
Copy link
Collaborator

thank you very much for the PR, i will merge this as a temporary fix but need to find a proper solution (why is the key missing) in the long run.

@djstini
Copy link
Contributor Author

djstini commented Sep 1, 2023

had some time to dig deeper. The issue happens during then checking if a "Food" already exists, the "IF" in L.130.

Here we validate if the "name" or "plural_name" from the open data file is included in a previously assembled "existing_objects_flat" list.

This works okay, as long as all the names and plural_names are unique.

In the Translations this is lost.

For example in German:
| key | name - GER |
| food-cilantro-raw | Koriander |
| food-spices-coriander-seed | Koriander |
| food-milk-lowfat | Fettarme Milch |
| food-milk-reduced-fat | Fettarme Milch |
| food-kale | Grünkohl |
| food-cabbage-green-raw | Grünkohl |

Since this exists as a duplicate, the second occurrence will not be added to the insert_list, therefore never being created, therefore not existing when trying to add the properties ( at the place where i added the try catch. )

In German the Error is only for the 3 Foods, i will submit a change to the open data List fixing them soon.

I'd recommend leaving in the try-catch, as this is a problem that can occur in the future, since the lists are constantly subject to change.

@vabene1111
Copy link
Collaborator

hi, thanks for digging into this. I understand the issue. I really wanted to use tandoors default translation system for translations but there we cannot enforce uniqueness, maybe we need to move it to the open data system as well.

need to think about this but will get this merged for the meantime.

Thanks for the work :)

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