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

Touch:true change putting duplicate spree_state_changes records in on save #4072

Closed
jswencki-godaddy opened this issue Dec 6, 2013 · 2 comments

Comments

@jswencki-godaddy
Copy link

72154c7#diff-ba13136dc18703884af4dc9585973124R5

and

72154c7#diff-d985c9327156568e9d480c22cfdac03eR7

are putting multiple entries in the spree_state_changes table now with same data when an order is cancelled or marked shipped. The only difference is the time stamps. It seems this should not be the case in spree_state_changes as the state is not changing.

Version:
2-0-Stable

Steps:

  1. Admin
  2. Edit Order
  3. Cancel Order
  4. See entries below.

There are now two sets of entries instead of one. No state change, just the dates changed.

screen shot 2013-12-06 at 1 48 19 pm

Expectation:
One set of entries in spree_state_changes as it was prior to the update.

@radar
Copy link
Contributor

radar commented Dec 11, 2013

I'm sure that I had some regression tests in the system already for state_changes where the previous + next values were the same, but for the life of me I cannot find them. That part of this issue is the easiest of the two parts to fix.

I've got a commit on master, 2-1-stable and 2-0-stable for that part now.

Going to look at why there's two state_changes entered for shipments right after lunch.

Thanks for letting us know about this @jswencki!

@radar
Copy link
Contributor

radar commented Dec 11, 2013

I am not too sure that I can actually fix this one on 2-0-stable or 2-1-stable, as it appears it's called when Adjustment#update_adjustable is called, as well as when Shipment#update_order is called. We've worked on refactoring this flow for the master branch and it's quite a large change there... I don't think we'll be able to fix this on 2-0-stable and 2-1-stable, sorry.


On the master branch, state transitions aren't even logged for shipments and payments weren't even being logged when the order was canceled! I've submitted some patches to fix this up too.

@radar radar closed this as completed Dec 11, 2013
radar added a commit that referenced this issue Dec 11, 2013
radar added a commit that referenced this issue Dec 11, 2013
In retrospect, this seems very obvious.

Fixes #4072

Conflicts:
	core/app/models/spree/order.rb
	core/spec/models/spree/order_spec.rb
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

No branches or pull requests

2 participants