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

Remove whitespace from level names to fix seeding #51968

Merged
merged 1 commit into from
May 18, 2023

Conversation

bethanyaconnor
Copy link
Contributor

@bethanyaconnor bethanyaconnor commented May 18, 2023

Seeding was failing on multiple environments with an error like:

Error parsing config/scripts/virtual_pl_csd_summer_day2_async11.external
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Name has already been taken

Strangely, locally, seeding was successful once then failed consistently (with that error) after that. The back trace pointed to this line, ie level.update!(name: data[:name], game_id: Game.find_by(name: to_s).id, properties: data[:properties], md5: md5). What was happening was that we strip whitespace from level names before validation (and, therefore, before save). However, a couple of lines before the failing line we do level = find_or_create_by({name: data[:name]}) without stripping whitespace. This means that it was trying to create a new level with whitespace in the name then, when it went to save that, had a conflict on the name field, with itself.

There's a longer term fix here that I can likely get out today but this should unblock the builds now.

@bethanyaconnor bethanyaconnor marked this pull request as ready for review May 18, 2023 13:45
Copy link
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation!

@bethanyaconnor bethanyaconnor merged commit 943cab5 into staging May 18, 2023
1 of 2 checks passed
@bethanyaconnor bethanyaconnor deleted the bethany/fix-build-0518 branch May 18, 2023 14:02
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.

None yet

2 participants