Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Do not consider promotions without actions as active #3749
Conversation
|
Thanks for hopping on this @DanielePalombo ! Apologies, I've been underwater with work and haven't been able to make time back to this. |
96bd049
to
473870c
|
Left a non-blocking comment. Thanks to both @wildbillcat and @DanielePalombo. |
| @@ -84,7 +93,7 @@ def not_expired? | |||
| end | |||
|
|
|||
| def active? | |||
| started? && not_expired? | |||
| started? && not_expired? && (Spree::Config.actionless_promotion_inactive ? actions.present? : true) | |||
kennyadsl
Sep 7, 2020
Member
What about a different method (has_actions?) for this?
What about a different method (has_actions?) for this?
DanielePalombo
Oct 2, 2020
Author
Contributor
I think that has_actions? would be confused because it will return true is the preference actionless_promotion_inactive is false.
I have considered this suggestion and following the @aldesantis comments I have named it consider_active_by_actions_presence
I think that has_actions? would be confused because it will return true is the preference actionless_promotion_inactive is false.
I have considered this suggestion and following the @aldesantis comments I have named it consider_active_by_actions_presence
...lib/generators/solidus/install/templates/config/initializers/spree.rb.tt
Outdated
Show resolved
Hide resolved
…no actions are assigned
e69ab26
to
a9b49c4
a9b49c4
to
08e1ba7
08e1ba7
to
84192cf
|
Left a couple of comments about some terms. The rest looks good to me, thanks! |
...lib/generators/solidus/install/templates/config/initializers/spree.rb.tt
Outdated
Show resolved
Hide resolved
Remove the join table otherwise started_and_unexpired scope will return only the promotion with actions, and the code doesn't reproduce the deprecated behavior
84192cf
to
109c1bb
|
@aldesantis can you please review again when you have some time? |
176e3a7
into
solidusio:master
This PR is based on #3596.
From original PR:
This is a proposed solution to #2777 where action-less promotions were considered active. As opposed to my original thought of implementing validation, given that there is no state toggle on the promotion that it would make sense to embrace the inferred state. So this implementation just causes a promotion to be considered inactive until it has actions, in addition to the other required material. Otherwise it is considered inactive.
In the process I found the coupon promotion handler already treated action-less coupons as inactive, so I updated it to continue this behavior.
I have only added the spec and refactored it.
Thank you @wildbillcat
Checklist: