Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
titlepython manage.py shell
from tickets.models import OrderProduct
from collections import Counter
  
 
ops = OrderProduct.objects.filter(
     order__event__slug='tracon2017tracon2018',
     order__confirm_time__isnull=False,
     order__payment_date__isnull=False,
     order__cancellation_time__isnull=True,
      count__gte=1,
      product__name__icontains='viikonloppu',
)
ops.count()
# 2170

# Ei toimi enää, TypeError: 'OrderProduct' does not support indexing
c = Counter()
for op in ops:
   c[op.count] += 1

c
# Counter({1: 11711296, 2: 665631, 3: 211199, 4: 7663, 5: 3633, 6: 67, 7: 32, 8: 1, 109: 13})

 

Ohjelmanumerot, joista puuttuu ohjelmanjärjestäjän sähköpostiosoite

...