Skip to content

Commit

Permalink
Remove unused settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Friedrich committed Mar 26, 2018
1 parent 26522fd commit 5d327d0
Showing 1 changed file with 9 additions and 37 deletions.
46 changes: 9 additions & 37 deletions pretix_checkinlist_net/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,6 @@ def export_form_fields(self):
),
initial=self.event.checkin_lists.first()
)),
('secrets',
forms.BooleanField(
label=_('Include QR-code secret'),
required=False
)),
('paid_only',
forms.BooleanField(
label=_('Only paid orders'),
initial=True,
required=False
)),
('sort',
forms.ChoiceField(
label=_('Sort by'),
initial='name',
choices=(
('name', _('Attendee name')),
('code', _('Order code')),
),
widget=forms.RadioSelect,
required=False
)),
('questions',
forms.ModelMultipleChoiceField(
queryset=self.event.questions.all(),
Expand Down Expand Up @@ -89,22 +67,16 @@ def render(self, form_data: dict):
if cl.subevent:
qs = qs.filter(subevent=cl.subevent)

if form_data['sort'] == 'name':
qs = qs.order_by(Coalesce('attendee_name', 'addon_to__attendee_name'))
elif form_data['sort'] == 'code':
qs = qs.order_by('order__code')
# NET: Always sort by name
qs = qs.order_by(Coalesce('attendee_name', 'addon_to__attendee_name'))

headers = [
_('Order code'), _('Attendee name'), _('Product'), _('Price')
]
if form_data['paid_only']:
qs = qs.filter(order__status=Order.STATUS_PAID)
else:
qs = qs.filter(order__status__in=(Order.STATUS_PAID, Order.STATUS_PENDING))
headers.append(_('Paid'))

if form_data['secrets']:
headers.append(_('Secret'))
# NET: Always include paid/non-paid
qs = qs.filter(order__status__in=(Order.STATUS_PAID, Order.STATUS_PENDING))
headers.append(_('Paid'))

if self.event.settings.attendee_emails_asked:
headers.append(_('E-mail'))
Expand All @@ -124,10 +96,10 @@ def render(self, form_data: dict):
str(op.item.name) + (" – " + str(op.variation.value) if op.variation else ""),
op.price,
]
if not form_data['paid_only']:
row.append(_('Yes') if op.order.status == Order.STATUS_PAID else _('No'))
if form_data['secrets']:
row.append(op.secret)

# NET: Always include paid/non-paid
row.append(_('Yes') if op.order.status == Order.STATUS_PAID else _('No'))

if self.event.settings.attendee_emails_asked:
row.append(op.attendee_email or (op.addon_to.attendee_email if op.addon_to else ''))
if self.event.has_subevents:
Expand Down

0 comments on commit 5d327d0

Please sign in to comment.