mirror of
https://github.com/pretix/pretix.git
synced 2026-08-23 12:51:59 +00:00
Add name of waiting list entry to voucher
This commit is contained in:
@@ -188,6 +188,9 @@ class WaitingListEntry(LoggedModel):
|
|||||||
raise WaitingListException(_('This entry is anonymized and can no longer be used.'))
|
raise WaitingListException(_('This entry is anonymized and can no longer be used.'))
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
e = self.email
|
||||||
|
if self.name:
|
||||||
|
e += ' / ' + self.name
|
||||||
v = Voucher.objects.create(
|
v = Voucher.objects.create(
|
||||||
event=self.event,
|
event=self.event,
|
||||||
max_usages=1,
|
max_usages=1,
|
||||||
@@ -196,7 +199,7 @@ class WaitingListEntry(LoggedModel):
|
|||||||
variation=self.variation,
|
variation=self.variation,
|
||||||
tag='waiting-list',
|
tag='waiting-list',
|
||||||
comment=_('Automatically created from waiting list entry for {email}').format(
|
comment=_('Automatically created from waiting list entry for {email}').format(
|
||||||
email=self.email
|
email=e
|
||||||
),
|
),
|
||||||
block_quota=True,
|
block_quota=True,
|
||||||
subevent=self.subevent,
|
subevent=self.subevent,
|
||||||
|
|||||||
@@ -120,13 +120,17 @@ class WaitingListTestCase(TestCase):
|
|||||||
def test_send_custom_validity(self):
|
def test_send_custom_validity(self):
|
||||||
self.event.settings.set('waiting_list_hours', 24)
|
self.event.settings.set('waiting_list_hours', 24)
|
||||||
wle = WaitingListEntry.objects.create(
|
wle = WaitingListEntry.objects.create(
|
||||||
event=self.event, item=self.item2, variation=self.var1, email='foo@bar.com'
|
event=self.event, item=self.item2, variation=self.var1, email='foo@bar.com',
|
||||||
|
name_parts={'_legacy': 'Max'}
|
||||||
)
|
)
|
||||||
wle.send_voucher()
|
wle.send_voucher()
|
||||||
wle.refresh_from_db()
|
wle.refresh_from_db()
|
||||||
|
|
||||||
assert 3600 * 23 < (wle.voucher.valid_until - now()).seconds < 3600 * 24
|
assert 3600 * 23 < (wle.voucher.valid_until - now()).seconds < 3600 * 24
|
||||||
|
|
||||||
|
assert 'foo@bar.com' in wle.voucher.comment
|
||||||
|
assert 'Max' in wle.voucher.comment
|
||||||
|
|
||||||
def test_send_auto(self):
|
def test_send_auto(self):
|
||||||
with scope(organizer=self.o):
|
with scope(organizer=self.o):
|
||||||
self.quota.variations.add(self.var1)
|
self.quota.variations.add(self.var1)
|
||||||
|
|||||||
Reference in New Issue
Block a user