Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Tickets' into Feature-Tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanThomsen committed Apr 12, 2022
2 parents 3d741cb + ffc438c commit 3360de1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 45 deletions.
13 changes: 12 additions & 1 deletion stregsystem/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
from django.contrib import messages
from django.contrib.admin.models import LogEntry

from stregsystem.models import Category, Member, News, Payment, PayTransaction, Product, Room, Sale, MobilePayment, Event
from stregsystem.models import (
Category,
Member,
News,
Payment,
PayTransaction,
Product,
Room,
Sale,
MobilePayment,
Event,
)
from stregsystem.templatetags.stregsystem_extras import money
from stregsystem.utils import make_active_productlist_query, make_inactive_productlist_query

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 2.2.24 on 2021-11-24 16:54
# Generated by Django 2.2.24 on 2022-04-12 17:47

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -7,7 +7,7 @@
class Migration(migrations.Migration):

dependencies = [
('stregsystem', '0014_mobilepayment_nullable_customername_20210908_1522'),
('stregsystem', '0015_product_caffeine_content_mg'),
]

operations = [
Expand All @@ -16,6 +16,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=32)),
('active', models.BooleanField()),
('time', models.DateTimeField()),
('ticket_start_threshold', models.DateTimeField()),
('ticket_end_threshold', models.DateTimeField()),
Expand Down
19 changes: 0 additions & 19 deletions stregsystem/migrations/0016_event_active.py

This file was deleted.

6 changes: 3 additions & 3 deletions stregsystem/templates/stregsystem/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
<center>
<table cellpadding="8px">
<tr>
<th>
<a href="/{{room.id}}/user/{{member.id}}/tickets">Mine billeter</a>
</th>
<th>
<a href="/{{room.id}}/user/{{member.id}}">Bruger Info</a>
</th>
<th>
<a href="/{{room.id}}/user/{{member.id}}/pay">Indsæt penge</a>
</th>
<th>
<a href="/{{room.id}}/user/{{member.id}}/tickets">Mine billetter</a>
</th>
<th>
<a href="/{{room.id}}/user/{{member.id}}/rank">Rangliste</a>
Expand Down
1 change: 0 additions & 1 deletion stregsystem/templates/stregsystem/menu_ticketsview.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@
{% endautoescape %}
</table>
</center>
<h1>{{kek}}</h1>

{% endblock %}
8 changes: 4 additions & 4 deletions stregsystem/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def test_is_active_active_not_expired(self):
product=product,
time=timezone.now() + datetime.timedelta(hours=1),
ticket_start_threshold=timezone.now() - datetime.timedelta(hours=1),
ticket_end_threshold=timezone.now() + datetime.timedelta(hours=1)
ticket_end_threshold=timezone.now() + datetime.timedelta(hours=1),
)

self.assertTrue(event.is_active())
Expand All @@ -645,7 +645,7 @@ def test_is_active_active_expired_after(self):
product=product,
time=timezone.now() + datetime.timedelta(hours=1),
ticket_start_threshold=timezone.now() - datetime.timedelta(hours=10),
ticket_end_threshold=timezone.now() - datetime.timedelta(hours=1)
ticket_end_threshold=timezone.now() - datetime.timedelta(hours=1),
)

self.assertFalse(event.is_active())
Expand All @@ -661,7 +661,7 @@ def test_is_active_active_before_active(self):
product=product,
time=timezone.now() + datetime.timedelta(hours=1),
ticket_start_threshold=timezone.now() + datetime.timedelta(hours=2),
ticket_end_threshold=timezone.now() + datetime.timedelta(hours=5)
ticket_end_threshold=timezone.now() + datetime.timedelta(hours=5),
)

self.assertFalse(event.is_active())
Expand All @@ -677,7 +677,7 @@ def test_is_active_inactive(self):
product=product,
time=timezone.now() + datetime.timedelta(hours=1),
ticket_start_threshold=timezone.now() - datetime.timedelta(hours=10),
ticket_end_threshold=timezone.now() - datetime.timedelta(hours=1)
ticket_end_threshold=timezone.now() - datetime.timedelta(hours=1),
)

self.assertFalse(event.is_active())
Expand Down
16 changes: 1 addition & 15 deletions stregsystem/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,21 +223,7 @@ def menu_userinfo(request, room_id, member_id):
def menu_ticketsview(request, room_id, member_id):
room = Room.objects.get(pk=room_id)
member = Member.objects.get(pk=member_id, active=True)
event_list = Event.objects.all()
kek = 2

sale_list = member.sale_set.order_by('-timestamp')
bought_product_list = []
bought_events_list = []

for sale in sale_list:
if sale.product not in bought_product_list:
bought_product_list.append(sale.product)

for event in event_list:
if event.product in bought_product_list and event.is_active():
bought_events_list.append(event)

bought_events_list = Event.objects.filter(product__in=member.sale_set.values('product'))

return render(request, 'stregsystem/menu_ticketsview.html', locals())

Expand Down

0 comments on commit 3360de1

Please sign in to comment.