Comics-Games-and-Things-LLC / openCGaT

BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Investigate why discount codes get dropped from merged carts #128

Open nstephenh opened 1 month ago

nstephenh commented 1 month ago
  1. Investigate the past, write a script looking at merged carts and discount codes on them vs discount codes on the cart they were merged into.

  2. Write tests for each case (which cart had the code, etc.

  3. Fix the problem.

nstephenh commented 3 weeks ago

Unfortunately when we merge a cart we don't actually save the information on what cart it was merged into so there's no record of which cart we merged into and we can't investigate point 1.

On merging it should copy the code, or otherwise keep the code if this cart was the cart it was merging into:

        if not self.discount_code and cart2.discount_code:
            cart2.discount_code.validate_code_for_cart(self)
            self.save()
nstephenh commented 6 days ago

I've added a "merge target" field in b64de80f9807c1c64213f3f6916c16f2bdacbf36

nstephenh commented 1 day ago

Which I think doesn't do anything because we clear the code off the old cart. It was an issue with cart 238256, merged from 237799. Will see if I can reproduce with a local terminal

nstephenh commented 1 day ago

Looking at that cart, there was a discount code message of eob2410 has expired, so I think that code was on the cart and we didn't overwrite it because of that. So we either need to check to see which code is more valid or disregard the "not self.discount_code" indicator.