brodycritchlow / Ticketing-System

A fully functional ticket system backend.
2 stars 1 forks source link

Discounts not being applied correctly. #2

Open brodycritchlow opened 9 months ago

brodycritchlow commented 9 months ago

Our current discounting system, is not applying the stacking and non-stacking discounts correctly. Here is some things I think we should do:

Thanoon12k commented 9 months ago

Hi dear, it is my first issue, I hope it will help you I made small edits on the logic in User class remove_funds function I can't commit or do pull request

brodycritchlow commented 9 months ago

@Thanoon12k Hi, would you mind creating a pull request with your updated changes (requesting to merge your fork into the main repo). So i can go ahead and review?

brodycritchlow commented 8 months ago

Resolved in latest commits.

brodycritchlow commented 8 months ago

Reopening this due to a small change that can be made:

We can take advantage of set in python to use intersections so we don't have to do two dictionary comprehensions. Presumably saving some memory.

>>> a = {"test": [300, True], "test2": [400, False], "test3": [100, True]}
>>> b = {k: v for k, v in a.items() if v[1] == True} # our stacking discounts
>>> set(a) ^ set(b) # our non-stacking discounts [names]
{'test2'}