diff --git a/website/templates/website/base.html b/website/templates/website/base.html
index d02691b..ab64e7a 100644
--- a/website/templates/website/base.html
+++ b/website/templates/website/base.html
@@ -97,7 +97,9 @@ $.ajaxSetup({
-
+
+
+
diff --git a/website/views.py b/website/views.py
index 7e3419b..f193f43 100644
--- a/website/views.py
+++ b/website/views.py
@@ -27,18 +27,26 @@ def home_view(request):
# Countdown
countdown = dict()
- events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:1]
+ events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:3]
+
if ( len(events) > 0 ):
+ i = 0
nextEvent = events[0]
+ while datetime.combine( nextEvent.date, nextEvent.time ) < datetime.now():
+ if len(events ) <= i:
+ return
+ else:
+ i += 1
+ nextEvent = events[i]
if EventParticipation.isMember( request.user ):
part = EventParticipation.objects.filter( user = request.user ).filter( event = nextEvent )
countdown['participation'] = part[0].status
- eventTime = datetime( events[0].date.year, events[0].date.month, events[0].date.day,
- events[0].displaytime.hour, events[0].displaytime.minute )
+ eventTime = datetime( nextEvent.date.year, nextEvent.date.month, nextEvent.date.day,
+ nextEvent.displaytime.hour, nextEvent.displaytime.minute )
- countdown['event'] = events[0]
+ countdown['event'] = nextEvent
countdown['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 )
context['countdown'] = countdown