handed_out -> ticket_generated

This commit is contained in:
Víðir Valberg Guðmundsson 2019-07-18 21:20:29 +02:00
parent b1b810f165
commit cad3b21fc4
6 changed files with 25 additions and 25 deletions

View File

@ -13,7 +13,7 @@
Use this view to hand out badges to participants. Use the search field to search for username, email, products, order ID, ticket UUID, etc. To check in participants go to the <a href="{% url 'backoffice:ticket_checkin' camp_slug=camp.slug %}">Ticket Checkin view</a> instead. To hand out merchandise and other products go to the <a href="{% url 'backoffice:product_handout' camp_slug=camp.slug %}">Hand Out Products</a> view instead.
</div>
<div>
This table shows all (Shop|Discount|Sponsor)Tickets which are badge_handed_out=False. Tickets must be checked in before they are shown in this list.
This table shows all (Shop|Discount|Sponsor)Tickets which are badge_ticket_generated=False. Tickets must be checked in before they are shown in this list.
</div>
</div>
<br>

View File

@ -13,7 +13,7 @@
Use this view to hand out products to participants. Use the search field to search for username, email, products, order ID etc. To check in participants go to the <a href="{% url 'backoffice:ticket_checkin' camp_slug=camp.slug %}">Ticket Checkin view</a> instead. To hand out badges go to the <a href="{% url 'backoffice:badge_handout' camp_slug=camp.slug %}">Badge Handout view</a> instead.
</div>
<div>
This table shows all OrderProductRelations which are handed_out=False (not including unpaid, cancelled and refunded orders). The table is initally sorted by order ID but the sorting can be changed by clicking the column headlines (if javascript is enabled).
This table shows all OrderProductRelations which are ticket_generated=False (not including unpaid, cancelled and refunded orders). The table is initally sorted by order ID but the sorting can be changed by clicking the column headlines (if javascript is enabled).
</div>
</div>
<br>

View File

@ -41,7 +41,7 @@ class ProductHandoutView(CampViewMixin, InfoTeamPermissionMixin, ListView):
def get_queryset(self, **kwargs):
return OrderProductRelation.objects.filter(
handed_out=False,
ticket_generated=False,
order__paid=True,
order__refunded=False,
order__cancelled=False,
@ -53,9 +53,9 @@ class BadgeHandoutView(CampViewMixin, InfoTeamPermissionMixin, ListView):
context_object_name = "tickets"
def get_queryset(self, **kwargs):
shoptickets = ShopTicket.objects.filter(badge_handed_out=False)
sponsortickets = SponsorTicket.objects.filter(badge_handed_out=False)
discounttickets = DiscountTicket.objects.filter(badge_handed_out=False)
shoptickets = ShopTicket.objects.filter(badge_ticket_generated=False)
sponsortickets = SponsorTicket.objects.filter(badge_ticket_generated=False)
discounttickets = DiscountTicket.objects.filter(badge_ticket_generated=False)
return list(chain(shoptickets, sponsortickets, discounttickets))
@ -152,7 +152,7 @@ class MerchandiseOrdersView(CampViewMixin, OrgaTeamPermissionMixin, ListView):
return (
OrderProductRelation.objects.filter(
handed_out=False,
ticket_generated=False,
order__paid=True,
order__refunded=False,
order__cancelled=False,
@ -170,7 +170,7 @@ class MerchandiseToOrderView(CampViewMixin, OrgaTeamPermissionMixin, TemplateVie
camp_prefix = "BornHack {}".format(timezone.now().year)
order_relations = OrderProductRelation.objects.filter(
handed_out=False,
ticket_generated=False,
order__paid=True,
order__refunded=False,
order__cancelled=False,
@ -198,7 +198,7 @@ class VillageOrdersView(CampViewMixin, OrgaTeamPermissionMixin, ListView):
return (
OrderProductRelation.objects.filter(
handed_out=False,
ticket_generated=False,
order__paid=True,
order__refunded=False,
order__cancelled=False,
@ -216,7 +216,7 @@ class VillageToOrderView(CampViewMixin, OrgaTeamPermissionMixin, TemplateView):
camp_prefix = "BornHack {}".format(timezone.now().year)
order_relations = OrderProductRelation.objects.filter(
handed_out=False,
ticket_generated=False,
order__paid=True,
order__refunded=False,
order__cancelled=False,

View File

@ -46,4 +46,4 @@ class OrderProductRelationFactory(DjangoModelFactory):
product = factory.SubFactory(ProductFactory)
order = factory.SubFactory(OrderFactory)
quantity = 1
handed_out = False
ticket_generated = False

View File

@ -289,35 +289,35 @@ class Order(CreatedUpdatedModel):
self.open = None
self.save()
def is_not_handed_out(self):
if self.orderproductrelation_set.filter(handed_out=True).count() == 0:
def is_not_ticket_generated(self):
if self.orderproductrelation_set.filter(tic=True).count() == 0:
return True
else:
return False
def is_partially_handed_out(self):
def is_partially_ticket_generated(self):
if (
self.orderproductrelation_set.filter(handed_out=True).count() != 0
and self.orderproductrelation_set.filter(handed_out=False).count() != 0
self.orderproductrelation_set.filter(ticket_generated=True).count() != 0
and self.orderproductrelation_set.filter(ticket_generated=False).count() != 0
):
# some products are handed out, others are not
return True
else:
return False
def is_fully_handed_out(self):
if self.orderproductrelation_set.filter(handed_out=False).count() == 0:
def is_fully_ticket_generated(self):
if self.orderproductrelation_set.filter(ticket_generated=False).count() == 0:
return True
else:
return False
@property
def handed_out_status(self):
if self.is_not_handed_out():
def ticket_generated_status(self):
if self.is_not_ticket_generated():
return "no"
elif self.is_partially_handed_out():
elif self.is_partially_ticket_generated():
return "partially"
elif self.is_fully_handed_out():
elif self.is_fully_ticket_generated():
return "fully"
else:
return False
@ -473,7 +473,7 @@ class OrderProductRelation(CreatedUpdatedModel):
return Decimal(self.product.price * self.quantity)
def clean(self):
if self.handed_out and not self.order.paid:
if self.ticket_generated and not self.order.paid:
raise ValidationError(
"Product can not be handed out when order is not paid."
)

View File

@ -25,13 +25,13 @@
<tbody>
{% for order in orders %}
{% if order.products.exists %}
<tr {% if not order.open and order.paid and order.is_fully_handed_out %}style="color: lightgrey"{% endif %}>
<tr {% if not order.open and order.paid and order.is_fully_ticket_generated %}style="color: lightgrey"{% endif %}>
<td>{{ order.id }}</td>
<td>{{ order.get_number_of_items }}</td>
<td>{{ order.total|currency }}</td>
<td class="text-center">{{ order.open|truefalseicon }}</td>
<td class="text-center">{{ order.paid|truefalseicon }}</td>
<td class="text-center">{{ order.handed_out_status }}</td>
<td class="text-center">{{ order.ticket_generated_status }}</td>
<td>
{% if order.paid %}
{% if order.invoice.pdf %}