mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Orders API: Silently fail if an answer to a question is submitted twice
This commit is contained in:
@@ -1292,7 +1292,13 @@ class OrderCreateSerializer(I18nAwareModelSerializer):
|
|||||||
if pos.voucher:
|
if pos.voucher:
|
||||||
Voucher.objects.filter(pk=pos.voucher.pk).update(redeemed=F('redeemed') + 1)
|
Voucher.objects.filter(pk=pos.voucher.pk).update(redeemed=F('redeemed') + 1)
|
||||||
pos.save()
|
pos.save()
|
||||||
|
seen_answers = set()
|
||||||
for answ_data in answers_data:
|
for answ_data in answers_data:
|
||||||
|
# Workaround for a pretixPOS bug :-(
|
||||||
|
if answ_data.get('question') in seen_answers:
|
||||||
|
continue
|
||||||
|
seen_answers.add(answ_data.get('question'))
|
||||||
|
|
||||||
options = answ_data.pop('options', [])
|
options = answ_data.pop('options', [])
|
||||||
|
|
||||||
if isinstance(answ_data['answer'], File):
|
if isinstance(answ_data['answer'], File):
|
||||||
|
|||||||
Reference in New Issue
Block a user