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

Backport promotion code batch fix from Solidus #57

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Oct 27, 2023

Backport Solidus PR 5383 with PR description:

When a new promotion with 2.5m new promo codes has created, it just generated about 250k promo codes and then stopped.

The PromotionBatch screen this error: Errored: #<ActiveRecord::RecordInvalid: Validation failed: Value has already been taken>

This PR rescues the exception raised by the Spree::PromotionCode creation and jumps to the next code to save, avoiding stopping the process completely. The PR also adds the ability to restart the PromotionCodeBatch from the latest PromotionCodes created.

Cf solidusio/solidus#5383

Backport Solidus PR 5383 with PR description:

When a new promotion with 2.5m new promo codes has created, it just generated about 250k promo codes and then stopped.

The PromotionBatch screen this error: Errored: #<ActiveRecord::RecordInvalid: Validation failed: Value has already been taken>

This PR rescues the exception raised by the Spree::PromotionCode creation and jumps to the next code to save, avoiding stopping the process completely.
The PR also adds the ability to restart the PromotionCodeBatch from the latest PromotionCodes created.

Co-Authored-By: Daniele Palombo
Copy link
Collaborator

@davecandlescience davecandlescience 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

@mamhoff mamhoff merged commit 541e04b into main Oct 27, 2023
mamhoff added a commit that referenced this pull request Jul 1, 2024
Backport promotion code batch fix from Solidus
mamhoff added a commit that referenced this pull request Oct 25, 2024
Backport promotion code batch fix from Solidus
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