Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: made voucher name unique
Browse files Browse the repository at this point in the history
  • Loading branch information
zubair-ce07 committed Sep 22, 2023
1 parent a751b28 commit 95330bf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions ecommerce/extensions/voucher/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,7 @@ def create_new_voucher(code, end_datetime, name, start_datetime, voucher_type):
if not isinstance(end_datetime, datetime.datetime):
end_datetime = dateutil.parser.parse(end_datetime)

voucher = Voucher.objects.last()
if voucher:
name = name + str(voucher.code)
name = name + voucher_code

voucher = Voucher.objects.create(
name=name[:128],
Expand Down

0 comments on commit 95330bf

Please sign in to comment.