Fixes
- Layout of menu bar destroyed by last fix - fixed countdown widget when event was on same day but passed..
This commit is contained in:
parent
220d204e5f
commit
a6a1620a53
|
@ -97,7 +97,9 @@ $.ajaxSetup({
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</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">
|
||||
<ul class="nav pull-right">
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue