Features: 1) Add additional filters to promocodes query, including used_on__isnull and start_time__lte.
Fixes: None; Extra: 1) Adjust query formatting for improved readability.
This commit is contained in:
parent
68db25e022
commit
661f9f2fe6
1 changed files with 6 additions and 1 deletions
|
|
@ -290,7 +290,12 @@ class Query(ObjectType):
|
||||||
promocodes = PromoCode.objects
|
promocodes = PromoCode.objects
|
||||||
if info.context.user.has_perm("core.view_promocode"):
|
if info.context.user.has_perm("core.view_promocode"):
|
||||||
return promocodes.filter(user__uuid=kwargs.get("user_uuid")) or promocodes.all()
|
return promocodes.filter(user__uuid=kwargs.get("user_uuid")) or promocodes.all()
|
||||||
return promocodes.filter(is_active=True, user=info.context.user)
|
return promocodes.filter(
|
||||||
|
is_active=True,
|
||||||
|
user=info.context.user,
|
||||||
|
used_on__isnull=True,
|
||||||
|
start_time__lte=info.context.now,
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_product_tags(_parent, info, **_kwargs):
|
def resolve_product_tags(_parent, info, **_kwargs):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue