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
Apply code reviews
Matthew Kennedy083cb01d4aeb
diff --git a/core/app/models/spree/wished_variant.rb b/core/app/models/spree/wished_variant.rbindex 103fae87f8..3ffa15da3a 100644--- a/core/app/models/spree/wished_variant.rb+++ b/core/app/models/spree/wished_variant.rb@@ -3,30 +3,24 @@ module Spreeextend DisplayMoneymoney_methods :total, :price- belongs_to :variant- belongs_to :wishlist+ belongs_to :variant, class_name: 'Spree::Variant'+ belongs_to :wishlist, class_name: 'Spree::Wishlist'- has_one :product, through: :variant+ has_one :product, class_name: 'Spree::Product', through: :variantvalidates :variant, :wishlist, presence: truedef price(currency)- variant_price = variant.price_in(currency[:currency]).amount-- if variant_price.nil?- variant_price- else- variant_price.to_i- end+ variant.amount_in(currency[:currency])enddef total(currency)- variant_price = variant.price_in(currency[:currency]).amount+ variant_price = variant.amount_in(currency[:currency])if variant_price.nil?variant_priceelse- quantity * variant_price.to_i+ quantity * variant_priceendendenddiff --git a/core/app/models/spree/wishlist.rb b/core/app/models/spree/wishlist.rbindex 30c718aef8..2746c8a420 100644--- a/core/app/models/spree/wishlist.rb+++ b/core/app/models/spree/wishlist.rb@@ -5,16 +5,15 @@ module Spreehas_secure_tokenbelongs_to :user, class_name: Spree.user_class.to_s- belongs_to :store, touch: true+ belongs_to :store, class_name: 'Spree::Store', touch: true- after_commit :ensure_default_exists_and_is_unique-- has_many :wished_variants, dependent: :destroy+ has_many :wished_variants, class_name: 'Spree::WishedVariant', dependent: :destroy+ after_commit :ensure_default_exists_and_is_uniquevalidates :name, :store, :user, presence: truedef include?(variant_id)- wished_variants.map(&:variant_id).include? variant_id.to_i+ wished_variants.exists?(variant_id: variant_id)enddef to_param