Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Remove promotion touching when applying promo on checkout (#13095)
Damian Legawiecc5f0ce7f6a13
diff --git a/core/app/models/spree/adjustment.rb b/core/app/models/spree/adjustment.rbindex 70c3540f86..d7c837dd7f 100644--- a/core/app/models/spree/adjustment.rb+++ b/core/app/models/spree/adjustment.rb@@ -107,7 +107,6 @@ module Spreeattributes[:eligible] = source.promotion.eligible?(target) if promotion?update_columns(attributes)- source.promotion.touch if promotion?amountenddiff --git a/core/spec/models/spree/adjustment_spec.rb b/core/spec/models/spree/adjustment_spec.rbindex fdb7fe1926..84ac143722 100644--- a/core/spec/models/spree/adjustment_spec.rb+++ b/core/spec/models/spree/adjustment_spec.rb@@ -207,10 +207,6 @@ describe Spree::Adjustment, type: :model dosubjectexpect(adjustment.eligible).to eq trueend-- it 'touches the promotion' do- expect { subject }.to change { promotion.reload.updated_at }- endendcontext "the promotion is not eligible" do@@ -220,10 +216,6 @@ describe Spree::Adjustment, type: :model dosubjectexpect(adjustment.eligible).to eq falseend-- it 'touches the promotion' do- expect { subject }.to change { promotion.reload.updated_at }- endendendenddiff --git a/core/spec/models/spree/promotion_spec.rb b/core/spec/models/spree/promotion_spec.rbindex e5ca8c16ea..fd048cbac4 100644--- a/core/spec/models/spree/promotion_spec.rb+++ b/core/spec/models/spree/promotion_spec.rb@@ -289,12 +289,6 @@ describe Spree::Promotion, type: :model doexpect(promotion.activate(payload)).to be trueexpect(promotion.orders.first).to eql orderend-- it 'touches the promotion' do- previous_updated_at = promotion.updated_at- expect(promotion.activate(payload)).to be true- expect(promotion.reload.updated_at).not_to eq(previous_updated_at)- endendcontext 'when not activated' do@@ -305,12 +299,6 @@ describe Spree::Promotion, type: :model doexpect(promotion.activate(payload)).to be_falseyexpect(promotion.orders).to be_emptyend-- it "doesn't the promotion" do- previous_updated_at = promotion.updated_at- expect(promotion.activate(payload)).to be_falsey- expect(promotion.reload.updated_at).to eq(previous_updated_at)- endendend