Eventplanning: New "needsAction" state
This commit is contained in:
parent
290db91956
commit
df22b838fa
|
@ -120,7 +120,8 @@ class Event ( models.Model ):
|
|||
class EventParticipation( models.Model ):
|
||||
OPTIONS = ( ('?' , _('?' )),
|
||||
('Yes', _('Yes')),
|
||||
('No' , _('No' ))
|
||||
('No' , _('No' )),
|
||||
('-' , _( '-' ))
|
||||
)
|
||||
|
||||
event = models.ForeignKey( Event, verbose_name=_("event") )
|
||||
|
@ -149,8 +150,8 @@ class EventParticipation( models.Model ):
|
|||
|
||||
futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() )
|
||||
|
||||
maybeObjects = futurePart.filter( user = user ).filter( status = '?' )
|
||||
if len( maybeObjects ) > 0:
|
||||
notYetEntered = futurePart.filter( user = user ).filter( status = '-' )
|
||||
if len( notYetEntered ) > 0:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
@ -175,7 +176,7 @@ class EventParticipation( models.Model ):
|
|||
try:
|
||||
result = EventParticipation.objects.get( event = event, user = user )
|
||||
except EventParticipation.DoesNotExist:
|
||||
result = EventParticipation.objects.create( event = event, user = user, status='?', comment = '' )
|
||||
result = EventParticipation.objects.create( event = event, user = user, status='-', comment = '' )
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -180,6 +180,15 @@
|
|||
<h2>Termine</h2>
|
||||
|
||||
<div class="span12">
|
||||
|
||||
<div class="alert alert-info">
|
||||
Es gibt jetzt einen vierten Zustand "nicht eingetragen", angezeigt durch nur
|
||||
blaue Buttons.<br>
|
||||
|
||||
"?" bedeutet jetzt: Ich habe mich eingetragen weiss aber noch nicht ob ich komme.
|
||||
Bitte nur selten benutzen!
|
||||
</div>
|
||||
|
||||
<div class="box-content">
|
||||
<table id="eventTable" class="table table-striped">
|
||||
|
||||
|
|
|
@ -70,6 +70,10 @@
|
|||
$(this).children("span.text").html("Nein");
|
||||
|
||||
} else if ( $(this).data('status') == "No" )
|
||||
{
|
||||
$(this).data( "status", "-" );
|
||||
$(this).children("span.text").html("-");
|
||||
} else if ( $(this).data('status') == "-" )
|
||||
{
|
||||
$(this).data( "status", "Yes" )
|
||||
.addClass("btn-success");
|
||||
|
@ -137,6 +141,13 @@
|
|||
|
||||
<h2>Termine</h2>
|
||||
|
||||
<div class="alert alert-info">
|
||||
Es gibt jetzt einen vierten Zustand "nicht eingetragen", angezeigt durch "-".<br>
|
||||
|
||||
"?" bedeutet jetzt: Ich habe mich eingetragen weiss aber noch nicht ob ich komme.
|
||||
Bitte nur selten benutzen!
|
||||
</div>
|
||||
|
||||
<div class="box-content">
|
||||
<table class="table table-striped">
|
||||
|
||||
|
@ -179,10 +190,14 @@
|
|||
<button class="btn btn-mini btn-danger eventButton" title="{{p.comment}}" data-status="{{p.status}}">
|
||||
<span class="text {% if p.comment %}with_comment{% endif %}">Nein</span>
|
||||
</button>
|
||||
{% else %}
|
||||
{% elif p.status == "?" %}
|
||||
<button class="btn btn-mini btn-warning eventButton" title="{{p.comment}}" data-status="{{p.status}}">
|
||||
<span class="text {% if p.comment %}with_comment{% endif %}">?</span>
|
||||
</button>
|
||||
{% else %}
|
||||
<button class="btn btn-mini eventButton" title="{{p.comment}}" data-status="{{p.status}}">
|
||||
<span class="text {% if p.comment %}with_comment{% endif %}">-</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% else %}
|
||||
|
|
|
@ -59,13 +59,15 @@ def buildGCalAttendeesObj( event ):
|
|||
for userMapping in UserGCalCoupling.objects.all():
|
||||
u = userMapping.user
|
||||
participation = EventParticipation.get_or_create( u, event )
|
||||
status = "tentative"
|
||||
|
||||
status = "needsAction"
|
||||
if participation.status == "?" : status = "tentative"
|
||||
if participation.status == 'Yes': status = "accepted"
|
||||
if participation.status == 'No' : status = "declined"
|
||||
|
||||
o = {
|
||||
'id': userMapping.email,
|
||||
'email': u.email,
|
||||
'email': userMapping.email,
|
||||
'displayName': u.username,
|
||||
'comment': participation.comment,
|
||||
'responseStatus': status,
|
||||
|
@ -253,12 +255,14 @@ def syncFromGoogleToLocal( service = None ):
|
|||
localId = e['extendedProperties']['private']['blechreizID']
|
||||
localEvent = Event.objects.get( pk=localId )
|
||||
for a in e['attendees']:
|
||||
user = User.objects.get( email= a['email'] )
|
||||
user = UserGCalCoupling.objects.get( email = a['email'] ).user
|
||||
part = EventParticipation.get_or_create( user, localEvent )
|
||||
if 'comment' in a:
|
||||
part.comment = a['comment']
|
||||
|
||||
if a['responseStatus'] == 'needsAction' or a['responseStatus']=='tentative':
|
||||
if a['responseStatus'] == 'needsAction' :
|
||||
part.status = "-"
|
||||
elif a['responseStatus']=='tentative':
|
||||
part.status = '?'
|
||||
elif a['responseStatus'] == 'accepted':
|
||||
part.status = 'Yes'
|
||||
|
|
Loading…
Reference in New Issue