rdp / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

discount is duplicated if you enter a free item then a discount promotion #97

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. on the checkout sequence, enter a working 'free item' code 
2. hit back
3. enter a discount code

What is the expected output? What do you see instead?
should have just the discount code.  instead has it twice

What version of the product are you using? On what operating system?
1.0a2

Please provide any additional information below.

appears that adding reload

    self.promotion_line_item.destroy if self.promotion_line_item
    self.reload # take that promo out

to about line 60 of order.rb fixes it.

Original issue reported on code.google.com by rogerpack2005 on 11 Jun 2008 at 11:04

GoogleCodeExporter commented 9 years ago
Is a little funny you be able to reproduce that, I saw the code is strange some 
time
ago but could not make it give me errors.

The problem here is not exactly the reload, but items in a collection are not
supposed to be erased that way. There are methods that rails adds to manipulate 
items
in a collection when you associate things, its prefered instead of just nuke a
reference. 

This is the right way to do it:

self.order_line_items.delete(self.promotion_line_item) if 
self.promotion_line_item

Another thing: this line is supposed to be above the "minimum cart value" 
comparison,
to not include promotions in the total to decide if a promotion should be 
accepted
(another teoric problem that I could not reproduce).

As I didn't finished the tests for some controllers, at the time I saw that I 
though
that something in the controller was making it don't give errors, I will try to
reproduce it again to include these patches that I already have.

Original comment by edmundo...@gmail.com on 14 Jun 2008 at 2:45

GoogleCodeExporter commented 9 years ago
Again, I cannot reproduce it using the user interface, using Firefox I'm not 
allowed
to hit the submit button the second time, after hitted back button. I can only 
press
it again if I go back changing the url to point to the first step again 
(checkout).
Using IE6 I can press the button but the previous promotion is discarded.

Im using 1.0.a3 but there was no change in the set_promo_code method from 
1.0.a2.

Original comment by edmundo...@gmail.com on 14 Jun 2008 at 4:46

GoogleCodeExporter commented 9 years ago
Added in the change edmundo mentioned just to ensure the reference is deleted 
in the
proper manner. r113

Original comment by subim...@gmail.com on 11 Aug 2008 at 10:45