Discount.validProducts is unused

Create issue
Issue #87 resolved
Former user created an issue

The Discount model contains a validProducts field that allows a discount to only apply when specified products have been added to an order. Currently there is no code in place to check this. Any discount code used when placing an order will be applied to your order regardless of what products are in your order.

Either remove the validProducts field from the Discount model, or implement the functionality suggested by it's presence.

Reported by sherbang

Comments (2)

  1. Chris Moffitt repo owner

    Implemented capability in [514]

    Will require changes before it can be merged in the product-model-refactor branch.

    The error checking it not super smart but I think it works for reasonable cases and we can expect the shop owner to have some thoughts before throwing discounts out there.

  2. Chris Moffitt repo owner

    Yup, this is true. Right now I wanted to get the models in place so that we wouldn't have to change the database in the future.

    With the recent discount code, it should be pretty simple to utilize this field to validate that the objects on the order are indeed valid for the discount.

    It does get a little tricky if there are multiple items on the order and multiple discounts but we can try to get something basic in place first.

  3. Log in to comment