agenda: uncheck by default agenda with no events on all agendas page (fixes #2611)

This commit is contained in:
Mikaël Ates 2014-07-02 10:18:12 +02:00
parent b9fec24bfb
commit 1f163e447e
2 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,7 @@
<div class="worker-agenda">
<h2>
<strong>{{ service_name }}</strong> - Planning de {{ worker_agenda.worker.first_name }} <span class="lastname">{{ worker_agenda.worker.last_name }}</span>
<input type="checkbox" class="printable" checked>
<input type="checkbox" class="printable" {% if worker_agenda.has_events %}checked{% endif %}>
</h2>
<h3>{{ date|date:"DATE_FORMAT"|title }}</h3>

View File

@ -24,7 +24,7 @@ from calebasse.actes.validation import (automated_validation, unlock_all_acts_of
from calebasse import cbv
from calebasse.agenda.forms import (NewAppointmentForm, NewEventForm, UpdatePeriodicAppointmentForm,
DisablePatientAppointmentForm, UpdateAppointmentForm, UpdatePeriodicEventForm,
DisablePatientAppointmentForm, UpdateAppointmentForm, UpdatePeriodicEventForm,
UpdateEventForm, PeriodicEventsSearchForm)
logger = logging.getLogger(__name__)
@ -505,7 +505,8 @@ class AgendasTherapeutesView(AgendaHomepageView):
if all(map(lambda x: x.holiday, daily_appointments)):
continue
context['workers_agenda'].append({'worker': worker,
'appointments': daily_appointments})
'appointments': daily_appointments,
'has_events': True if events_worker else False})
for worker_agenda in context.get('workers_agenda', []):
patient_appointments = [x for x in worker_agenda['appointments'] if x.patient_record_id]