remove wrong info for now

This commit is contained in:
Thomas Steen Rasmussen 2021-07-22 07:55:58 +02:00
parent 21b479e253
commit b76cc2ed64
2 changed files with 3 additions and 11 deletions

View file

@ -14,9 +14,7 @@
<thead> <thead>
<tr> <tr>
<th>Ticket Type</th> <th>Ticket Type</th>
<th class="text-center">Number Sold</th> <th class="text-center">Tickets Generated</th>
<th class="text-right">Total Income</th>
<th class="text-right">Average Price</th>
<th class="text-center">Products</th> <th class="text-center">Products</th>
</tr> </tr>
</thead> </thead>
@ -25,8 +23,6 @@
<tr> <tr>
<td><a href="{% url 'backoffice:shop_ticket_stats_detail' camp_slug=camp.slug pk=tt.pk %}">{{ tt.name }}</a></td> <td><a href="{% url 'backoffice:shop_ticket_stats_detail' camp_slug=camp.slug pk=tt.pk %}">{{ tt.name }}</a></td>
<td class="text-center">{{ tt.shopticket_count }}</td> <td class="text-center">{{ tt.shopticket_count }}</td>
<td class="text-right">{{ tt.total_price|floatformat:"2" }} DKK</td>
<td class="text-right">{{ tt.average_price|floatformat:"2" }} DKK</td>
<td class="text-center">{{ tt.product_set.count }}</td> <td class="text-center">{{ tt.product_set.count }}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -18,12 +18,8 @@ logger = logging.getLogger("bornhack.%s" % __name__)
class TicketTypeManager(models.Manager): class TicketTypeManager(models.Manager):
def with_price_stats(self): def with_price_stats(self):
return ( return self.annotate(shopticket_count=models.Count("shopticket")).exclude(
self.annotate(shopticket_count=models.Count("shopticket")) shopticket_count=0
.annotate(average_price=models.Avg("shopticket__product__price"))
.annotate(total_price=models.Sum("shopticket__product__price"))
.exclude(shopticket_count=0)
.order_by("total_price")
) )