Versions Compared

Key

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

Table of Contents

Lippukauppa ja e-liput

Montako e-lipputilausta on lunastettu tiettynä päivänä

...

Code Block
languagesql
SELECT ti_o.id,ti_op.count AS _cnt FROM tickets_order AS ti_o, tickets_orderproduct AS ti_op 
WHERE ti_o.id=ti_op.order_id AND ti_o.event_id=49 AND ti_o.payment_date is not null
GROUP BY ti_o.id, ti_op.count, ti_op.product_id
HAVING (ti_op.product_id=130 AND ti_op.count > 4)
ORDER BY _cnt DESC;

...


Minkä kokoisia tilauksia ihmiset tilaa

Code Block
languagepy
titlepython manage.py shell
from tickets.models import OrderProduct
from collections import Counter
  
ops = OrderProduct.objects.filter(
    order__event__slug='tracon2018',
    order__confirm_time__isnull=False,
    order__payment_date__isnull=False,
    order__cancellation_time__isnull=True,
    count__gte=1,
    product__name__icontains='viikonloppu',
)
c = Counter()
for op in ops:
   c[op.count] += 1
c
# Counter({1: 1296, 2: 631, 3: 199, 4: 63, 5: 33, 6: 7, 7: 2, 8: 1, 9: 3})

...

Siirrä valittujen tilausten majoittujat toiseen kouluun

Code Block
languagepy
titlepython manage.py shell
from tickets.models import *

# order_ids = {101375, 101577, 101577, 101696, 101696, 101724, 101839, 101879, 101903, 102041, 102054, 102078, 102078, 102086, 102094, 102094, 102094, 102094, 102228, 102228, 102228, 102269, 102272, 102464, 102464, 102464, 102467, 102504, 102591, 102596, 102596, 102596, 102835, 102835, 102917, 103034, 103412, 103509, 103677, 103701, 103724, 103900, 104173}
order_ids = {104958}

product_map = {
    173: 175,
    174: 176,
}

lgroup_map = {
    135: 137,
    136: 138,
}

# Due to braindamage, shop leaves ops with count=0 lying around. This will cause IntegrityError when updating product of ops. So clean up.
# OrderProduct.objects.filter(order__confirm_time__isnull=False, count=0).delete()

# Swap products in orders
for old_product_id, new_product_id in product_map.items():
    old_product = Product.objects.get(id=old_product_id)
    print(old_product)
    ops = OrderProduct.objects.filter(order__in=order_ids, product=old_product_id, count__gt=0)
    print(ops.count())

    # Uncomment this to actually move
    # ops.update(product=new_product_id)

# Update references in AccommodationInformation
for old_lg_id, new_lg_id in lgroup_map.items():
    old_lg = LimitGroup.objects.get(id=old_lg_id)
    new_lg = LimitGroup.objects.get(id=new_lg_id)
    ais = AccommodationInformation.objects.filter(order_product__order__in=order_ids, limit_groups=old_lg_id)

    print(old_lg)
    for ai in ais:
        print(ai)

        # Uncomment these to actually move
        # ai.limit_groups.remove(old_lg)
        # ai.limit_groups.add(new_lg)


Badget ja nimilistat

Kuinka monta badgea on noudettu milläkin tunnilla

Code Block
languagesql
titlepsql
select date_trunc('hour', used_on) as hour, count(*)
from lippukala_code c
inner join lippukala_order o on (c.order_id = o.id)
where o.event = 'tracon2018'
group by hour
order by hour;

Ohjelmanhallinta 

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

Code Block
languagepy
titlepython manage.py shell
from programme.models import Programme
for programme in Programme.objects.filter(category__event__slug='traconx', programmerole__person__email='').distinct():
    print programme.title

Yleiset

Listaa kaikki taulut, joilla on vierasavain core_personiin

...