- Layout of menu bar destroyed by last fix
- fixed countdown widget when event was on same day but passed..
This commit is contained in:
Martin Bauer 2013-11-03 13:07:30 +01:00
parent 220d204e5f
commit a6a1620a53
2 changed files with 15 additions and 5 deletions

View File

@ -97,7 +97,9 @@ $.ajaxSetup({
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</a> </a>
<img alt="Blechreiz" src="{{STATIC_URL}}/img/blechreiz_logo.png"> <a class="brand" href="/">
<img alt="Blechreiz" src="{{STATIC_URL}}/img/blechreiz_logo.png">
</a>
<div class="nav-collapse collapse"> <div class="nav-collapse collapse">
<ul class="nav pull-right"> <ul class="nav pull-right">

View File

@ -27,18 +27,26 @@ def home_view(request):
# Countdown # Countdown
countdown = dict() 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 ): if ( len(events) > 0 ):
i = 0
nextEvent = events[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 ): if EventParticipation.isMember( request.user ):
part = EventParticipation.objects.filter( user = request.user ).filter( event = nextEvent ) part = EventParticipation.objects.filter( user = request.user ).filter( event = nextEvent )
countdown['participation'] = part[0].status countdown['participation'] = part[0].status
eventTime = datetime( events[0].date.year, events[0].date.month, events[0].date.day, eventTime = datetime( nextEvent.date.year, nextEvent.date.month, nextEvent.date.day,
events[0].displaytime.hour, events[0].displaytime.minute ) nextEvent.displaytime.hour, nextEvent.displaytime.minute )
countdown['event'] = events[0] countdown['event'] = nextEvent
countdown['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 ) countdown['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 )
context['countdown'] = countdown context['countdown'] = countdown