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

Promo code batch join chars #2662

Merged
merged 3 commits into from
Apr 5, 2018

Conversation

gevann
Copy link

@gevann gevann commented Mar 29, 2018

This PR aims to resolve #1946, allowing customization of promotion separator characters (currently always '_') via the admin. It stores the characters to use on the PromotionCodeBatch model, and has a default set to '_', so that users who do not wish to make use of this functionality do not need to change their workflows.

@@ -0,0 +1,9 @@
class AddJoinCharactersToPromotionCodeBatch < ActiveRecord::Migration[5.1]

Choose a reason for hiding this comment

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

Missing magic comment # frozen_string_literal: true.

Copy link
Author

Choose a reason for hiding this comment

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

Resolved.

@gevann gevann force-pushed the promo-code-batch-join-chars branch from 2c56732 to 393adcf Compare March 29, 2018 17:23
@@ -0,0 +1,10 @@
# frozen_string_literal: true
class AddJoinCharactersToPromotionCodeBatch < ActiveRecord::Migration[5.1]

Choose a reason for hiding this comment

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

Add an empty line after magic comments.

Copy link
Author

Choose a reason for hiding this comment

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

Resolved.

@@ -0,0 +1,10 @@
# frozen_string_literal: true
class AddJoinCharactersToPromotionCodeBatch < ActiveRecord::Migration[5.1]

Choose a reason for hiding this comment

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

Add an empty line after magic comments.

Copy link
Author

Choose a reason for hiding this comment

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

Resolved.

@gevann gevann force-pushed the promo-code-batch-join-chars branch from 393adcf to c673353 Compare March 29, 2018 17:24
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, just left a possible improvement

@@ -6,7 +6,8 @@ class PromotionCodeBatchJob < ActiveJob::Base

def perform(promotion_code_batch)
PromotionCode::BatchBuilder.new(
promotion_code_batch
promotion_code_batch,
join_characters: promotion_code_batch.join_characters
Copy link
Member

Choose a reason for hiding this comment

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

since the join_characters is included into the promotion_code_batch we are initializing the BatchBuilder with, what's the purpose of also passing it as a keyword argument? I think it could be better to keep the .new identical and work inside the BatchBuilder class to make the join_characters an instance attribute instead of a class level one

Graeme Nathan added 3 commits April 3, 2018 10:01
This commit adds a new string field to the PromotionCodeBatch model,
join_characters, in order to allow customizing which characters should
be used in promotion batch creation.

Default has been set to an underscore ('_') to keep in line with current
behavior.
Now that Spree::PromotionCodeBatch has a join_characters field, the job
which creates the batch of promotions should use this field.
@gevann gevann force-pushed the promo-code-batch-join-chars branch from c673353 to 7e51e78 Compare April 3, 2018 17:03
@gevann
Copy link
Author

gevann commented Apr 3, 2018

Suggested changes have been made, thanks!

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks

@kennyadsl kennyadsl merged commit 59494ba into solidusio:master Apr 5, 2018
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.

Allow customization of the promotion seperator
4 participants