Simplifies flag and discount filter functions
This commit is contained in:
parent
b9b50c6846
commit
abe8c12b05
2 changed files with 2 additions and 6 deletions
|
@ -127,12 +127,10 @@ class DiscountController(object):
|
||||||
"discount",
|
"discount",
|
||||||
)
|
)
|
||||||
|
|
||||||
valid_discounts = conditions.DiscountBase.objects.all()
|
|
||||||
|
|
||||||
all_subsets = []
|
all_subsets = []
|
||||||
|
|
||||||
for discounttype in discounttypes:
|
for discounttype in discounttypes:
|
||||||
discounts = discounttype.objects.filter(id__in=valid_discounts)
|
discounts = discounttype.objects.all()
|
||||||
ctrl = ConditionController.for_type(discounttype)
|
ctrl = ConditionController.for_type(discounttype)
|
||||||
discounts = ctrl.pre_filter(discounts, user)
|
discounts = ctrl.pre_filter(discounts, user)
|
||||||
all_subsets.append(discounts)
|
all_subsets.append(discounts)
|
||||||
|
|
|
@ -173,12 +173,10 @@ class FlagController(object):
|
||||||
types = list(ConditionController._controllers())
|
types = list(ConditionController._controllers())
|
||||||
flagtypes = [i for i in types if issubclass(i, conditions.FlagBase)]
|
flagtypes = [i for i in types if issubclass(i, conditions.FlagBase)]
|
||||||
|
|
||||||
all_flags = conditions.FlagBase.objects.all()
|
|
||||||
|
|
||||||
all_subsets = []
|
all_subsets = []
|
||||||
|
|
||||||
for flagtype in flagtypes:
|
for flagtype in flagtypes:
|
||||||
flags = flagtype.objects.filter(id__in=all_flags)
|
flags = flagtype.objects.all()
|
||||||
ctrl = ConditionController.for_type(flagtype)
|
ctrl = ConditionController.for_type(flagtype)
|
||||||
flags = ctrl.pre_filter(flags, user)
|
flags = ctrl.pre_filter(flags, user)
|
||||||
all_subsets.append(flags)
|
all_subsets.append(flags)
|
||||||
|
|
Loading…
Reference in a new issue