Giter VIP home page Giter VIP logo

Comments (8)

radar avatar radar commented on July 24, 2024

Could you please provide more thorough steps for us to reproduce the issue, including steps that clearly indicate that this is not performing correctly?

Thanks!

from spree_product_groups.

colleenbprice avatar colleenbprice commented on July 24, 2024

Here is my Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.2.6'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'pg'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2'
  gem 'coffee-rails', '~> 3.2'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test, :development do
  # Use thin so that I can see the overrides in action
  gem 'thin'

  # Pretty printed test output
  gem 'turn', '0.8.2', :require => false
  gem 'ffaker'
  gem 'guard-spork'
  gem 'factory_girl'
  gem 'rspec-rails'
  gem 'capybara'
  gem 'guard-rspec'
  gem 'launchy'
  gem 'diffy'
end

# gem 'thin'
gem 'execjs'
# Use of therubyracer is discouraged:
#   See: https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar#troubleshooting
# gem 'therubyracer'
# gem 'whenever', :require => false
gem 'delayed_job_active_record'

gem 'spree', :git => 'git://github.com/spree/spree', :branch => '1-1-stable'
gem 'spree_gateway', :git => 'git://github.com/spree/spree_gateway.git'

gem 'spree_product_groups', :git => 'git://github.com/spree/spree_product_groups.git'
gem 'spree_address_book', :git => 'git://github.com/danrasband/spree_address_book.git', :branch => '1.1.0'
gem 'spree_reuse_credit_card', :git => 'git://github.com/danrasband/spree_reuse_credit_card.git', :branch => '1.1.0'
gem 'spree_wishlist', :git => 'git://github.com/spree/spree_wishlist.git', :tag => "v1.3"
gem 'spree_email_to_friend', :git => 'git://github.com/spree/spree_email_to_friend.git'
gem 'spree_dynamic_sitemaps', :git => 'git://github.com/danrasband/spree_dynamic_sitemaps'
gem 'spree_reviews', :git => 'git://github.com/spree/spree_reviews'
gem 'spree_essentials', :git => 'git://github.com/citrus/spree_essentials.git', :branch => 'master'
gem 'spree_essential_blog', :git => 'git://github.com/citrus/spree_essential_blog.git', :branch => 'master'


# these three are for editing static content pages
gem 'spree_static_content', :git => 'git://github.com/spree/spree_static_content.git'
gem 'spree_editor', :git => 'git://raw.github.com/spree/spree_editor.git'
gem 'tinymce-rails', '>= 3.4.7.0.1'

It is happening when I follow these steps:

  1. Add a product or two
  2. Create a group and add products to it using the scope of "Products with IDs"
  3. Update the group

All is fine and dandy at this point. Then:

  1. Add a new product or edit a product that is not in your product group
  2. Go back to the product groups listing and you will see that the count is one more than it should be
  3. Open the product group and the list at the bottom shows the product you just added/edited
  4. Hit 'Update' without making any changes, and the product you just added/edited disappears and the group is as it should be.

from spree_product_groups.

colleenbprice avatar colleenbprice commented on July 24, 2024

Sorry to be a bother, but did you have a chance to look into this?

from spree_product_groups.

radar avatar radar commented on July 24, 2024

No not yet. I can look at it this week for you.

from spree_product_groups.

angelim avatar angelim commented on July 24, 2024

I can see the same behavior at times and that makes it harder to fix. I couldn't find out why, but its getting more and more common in production. I've scheduled a job after every product update to touch all group memberships ProductGroup.all.map(&:update_memberships). It also updates products in product groups based on price, another feature that I couldn't see working until now.

from spree_product_groups.

stefansenk avatar stefansenk commented on July 24, 2024

I also have the same problem. I have a product group set up via product ids and each time I edit a product it gets added to that product group until I do an update_memberships.

I believe the problem is that ProductGroup#include? is always returning true for a product group set up via product ids. This method is called for each product group after a product is saved and, as it returns true, an entry gets added in spree_product_groups_products for that product. When update_memberships gets called on the product group the associations get re-built correctly.

I have written a couple of tests and tweaked the way ProductGroup#include? works. This seems to work ok for me now, so here is the link to my changes. However, I am thinking that it may be better to change the way the scopes are merged in ProductScope#apply_on instead of this tweak to the scope, if that's feasible?
stefansenk@3247fc2

from spree_product_groups.

assembled avatar assembled commented on July 24, 2024

I have this same issue on 1-3-stable. @stefansenk fix stefansenk/spree_product_groups@3247fc2 fixes the issue for me.

from spree_product_groups.

fabiode avatar fabiode commented on July 24, 2024

I'm using spree_core at 1.1.7.beta and spree_product_groups at 1-3-stable and @stefansenk fix works for me too.
I don't know what is the trick, the first where syntax and the second returns the same, but it actually fixes the problem.

from spree_product_groups.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.