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 ):
|
class EventParticipation( models.Model ):
|
||||||
OPTIONS = ( ('?' , _('?' )),
|
OPTIONS = ( ('?' , _('?' )),
|
||||||
('Yes', _('Yes')),
|
('Yes', _('Yes')),
|
||||||
('No' , _('No' ))
|
('No' , _('No' )),
|
||||||
|
('-' , _( '-' ))
|
||||||
)
|
)
|
||||||
|
|
||||||
event = models.ForeignKey( Event, verbose_name=_("event") )
|
event = models.ForeignKey( Event, verbose_name=_("event") )
|
||||||
|
@ -149,8 +150,8 @@ class EventParticipation( models.Model ):
|
||||||
|
|
||||||
futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() )
|
futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() )
|
||||||
|
|
||||||
maybeObjects = futurePart.filter( user = user ).filter( status = '?' )
|
notYetEntered = futurePart.filter( user = user ).filter( status = '-' )
|
||||||
if len( maybeObjects ) > 0:
|
if len( notYetEntered ) > 0:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
@ -175,7 +176,7 @@ class EventParticipation( models.Model ):
|
||||||
try:
|
try:
|
||||||
result = EventParticipation.objects.get( event = event, user = user )
|
result = EventParticipation.objects.get( event = event, user = user )
|
||||||
except EventParticipation.DoesNotExist:
|
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
|
return result
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,15 @@
|
||||||
<h2>Termine</h2>
|
<h2>Termine</h2>
|
||||||
|
|
||||||
<div class="span12">
|
<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">
|
<div class="box-content">
|
||||||
<table id="eventTable" class="table table-striped">
|
<table id="eventTable" class="table table-striped">
|
||||||
|
|
||||||
|
|
|
@ -71,10 +71,14 @@
|
||||||
|
|
||||||
} else if ( $(this).data('status') == "No" )
|
} else if ( $(this).data('status') == "No" )
|
||||||
{
|
{
|
||||||
|
$(this).data( "status", "-" );
|
||||||
|
$(this).children("span.text").html("-");
|
||||||
|
} else if ( $(this).data('status') == "-" )
|
||||||
|
{
|
||||||
$(this).data( "status", "Yes" )
|
$(this).data( "status", "Yes" )
|
||||||
.addClass("btn-success");
|
.addClass("btn-success");
|
||||||
$(this).children("span.text").html("Ja");
|
$(this).children("span.text").html("Ja");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#saveButton').removeAttr('disabled');
|
$('#saveButton').removeAttr('disabled');
|
||||||
});
|
});
|
||||||
|
@ -132,11 +136,18 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form>
|
<form>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="row-fluid eventTable">
|
<div class="row-fluid eventTable">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
|
|
||||||
<h2>Termine</h2>
|
<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">
|
<div class="box-content">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|
||||||
|
@ -179,10 +190,14 @@
|
||||||
<button class="btn btn-mini btn-danger eventButton" title="{{p.comment}}" data-status="{{p.status}}">
|
<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>
|
<span class="text {% if p.comment %}with_comment{% endif %}">Nein</span>
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% elif p.status == "?" %}
|
||||||
<button class="btn btn-mini btn-warning eventButton" title="{{p.comment}}" data-status="{{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>
|
<span class="text {% if p.comment %}with_comment{% endif %}">?</span>
|
||||||
</button>
|
</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 %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -59,13 +59,15 @@ def buildGCalAttendeesObj( event ):
|
||||||
for userMapping in UserGCalCoupling.objects.all():
|
for userMapping in UserGCalCoupling.objects.all():
|
||||||
u = userMapping.user
|
u = userMapping.user
|
||||||
participation = EventParticipation.get_or_create( u, event )
|
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 == 'Yes': status = "accepted"
|
||||||
if participation.status == 'No' : status = "declined"
|
if participation.status == 'No' : status = "declined"
|
||||||
|
|
||||||
o = {
|
o = {
|
||||||
'id': userMapping.email,
|
'id': userMapping.email,
|
||||||
'email': u.email,
|
'email': userMapping.email,
|
||||||
'displayName': u.username,
|
'displayName': u.username,
|
||||||
'comment': participation.comment,
|
'comment': participation.comment,
|
||||||
'responseStatus': status,
|
'responseStatus': status,
|
||||||
|
@ -253,12 +255,14 @@ def syncFromGoogleToLocal( service = None ):
|
||||||
localId = e['extendedProperties']['private']['blechreizID']
|
localId = e['extendedProperties']['private']['blechreizID']
|
||||||
localEvent = Event.objects.get( pk=localId )
|
localEvent = Event.objects.get( pk=localId )
|
||||||
for a in e['attendees']:
|
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 )
|
part = EventParticipation.get_or_create( user, localEvent )
|
||||||
if 'comment' in a:
|
if 'comment' in a:
|
||||||
part.comment = a['comment']
|
part.comment = a['comment']
|
||||||
|
|
||||||
if a['responseStatus'] == 'needsAction' or a['responseStatus']=='tentative':
|
if a['responseStatus'] == 'needsAction' :
|
||||||
|
part.status = "-"
|
||||||
|
elif a['responseStatus']=='tentative':
|
||||||
part.status = '?'
|
part.status = '?'
|
||||||
elif a['responseStatus'] == 'accepted':
|
elif a['responseStatus'] == 'accepted':
|
||||||
part.status = 'Yes'
|
part.status = 'Yes'
|
||||||
|
|
Loading…
Reference in New Issue