manager: mark overquota and full events

This commit is contained in:
Frédéric Péters 2016-07-07 16:46:05 +02:00
parent 7b3dba5236
commit 3653b8f7aa
3 changed files with 39 additions and 1 deletions

View File

@ -8,3 +8,11 @@
max-width: 0%;
width: 100%;
}
.overbooking .occupation-bar {
background: #e33;
}
li.full {
background: #f8f8fe;
}

View File

@ -23,9 +23,13 @@
<div>
<ul class="objects-list single-links">
{% for event in object.event_set.all %}
<li data-total="{{event.places}}" data-booked="{{event.booked_places}}"><a rel="popup" href="{% url 'chrono-manager-event-edit' pk=event.id %}">
<li class="{% if event.booked_places > event.places %}overbooking{% endif %}
{% if event.full %}full{% endif %}"
data-total="{{event.places}}"
data-booked="{{event.booked_places}}"><a rel="popup" href="{% url 'chrono-manager-event-edit' pk=event.id %}">
{% if event.label %}{{event.label}} / {% endif %}
{{ event.start_datetime }}
{% if event.full %}/ <span class="full">{% trans "full" %}</span>{% endif %}
({% blocktrans with places=event.places booked_places=event.booked_places %}{{ places }} places, {{ booked_places }} booked places{% endblocktrans %}
{% if event.waiting_list_places %}
/

View File

@ -133,3 +133,29 @@ def test_booked_places(app, admin_user):
resp = app.get('/manage/agendas/%s/' % agenda.id, status=200)
assert '10 places' in resp.body
assert '2 booked places' in resp.body
def test_event_classes(app, admin_user):
agenda = Agenda(label=u'Foo bar')
agenda.save()
event = Event(start_datetime=datetime.datetime(2016, 2, 15, 17, 0),
places=10, agenda=agenda)
event.save()
for i in range(2):
Booking(event=event).save()
app = login(app)
resp = app.get('/manage/agendas/%s/' % agenda.id, status=200)
assert not 'full' in resp.body
assert not 'overbooking' in resp.body
for i in range(8):
Booking(event=event).save()
resp = app.get('/manage/agendas/%s/' % agenda.id, status=200)
assert 'full' in resp.body
assert not 'overbooking' in resp.body
Booking(event=event).save()
resp = app.get('/manage/agendas/%s/' % agenda.id, status=200)
assert 'full' in resp.body
assert 'overbooking' in resp.body