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

Fix issues with seeded data #47

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

driftingly
Copy link
Contributor

This PR fixes an issue with English language activity and Spanish and Mandarin artist names.

Problem 1

We're not seeing English language activity text: Both in the CMS and the FE, English language activity text (eg detailNarrative, lookAgain, and activityTemplate) isn't being correctly pulled in. Spanish and Mandarin content is working without issue.

From nikhil: "It appears that the seeders are not pulling that data in from the current production JSON files. I wonder if something is going awry with the English translations here: https://github.com/art-institute-of-chicago/journeymaker-cms/blob/develop/database/seeders/ArtworkSeeder.php#L71-L85"

Solution

nikhil correctly pointed out the source of the issue. When merging the English values with the translated values, I used the incorrect snake_casing when I should have built the English array using the same camelCasing as the translations. This bug affected the detail narrative, viewing description, activity instructions, and location directions.

Problem 2

We also do not see Spanish and Mandarin artist names: Similar, but different! Again, in both the CMS and the FE, the Spanish and Mandarin artist names aren't being pulled from the JSON. Within the CMS these fields are just blank, and then on the FE they render as null.

Solution

This one was more tricky. The artist's name appears in both the Spanish and Mandarin data. When the data is passed to ArtworkRepository::firstOrCreate it calls prepareFieldsBeforeCreate, which was setting $translatedFields.

$translatedFields = [
    'artist' => [
        'en' => $artist,
    ],
];

This bug was introduced in PR #40, updating seeders to add revisions and activity. Before this the ArtworkRepository was not used during the seeding process.

Copy link

@driftingly driftingly marked this pull request as ready for review June 27, 2024 00:17
Copy link
Member

@nikhiltri nikhiltri left a comment

Choose a reason for hiding this comment

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

Looks good! ⭐

@nikhiltri nikhiltri merged commit 8d89bf8 into develop Jun 27, 2024
2 checks passed
@nikhiltri nikhiltri deleted the drift/fix-seeder-translations branch June 27, 2024 19:50
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