misc: allow meetings to end past 11pm (#22967)

This commit is contained in:
Frédéric Péters 2018-04-14 09:36:20 +02:00
parent a2197b8ea4
commit 12a236d20b
2 changed files with 23 additions and 4 deletions

View File

@ -215,11 +215,10 @@ class AgendaDayView(DayArchiveView):
interval = datetime.timedelta(minutes=60)
current_date = self.date.replace(hour=min_timeperiod.hour, minute=0)
start_date = current_date
if max_timeperiod.minute == 0:
max_date = self.date.replace(hour=max_timeperiod.hour, minute=0)
else:
max_date = self.date.replace(hour=max_timeperiod.hour, minute=0)
if max_timeperiod.minute != 0:
# until the end of the last hour.
max_date = self.date.replace(hour=max_timeperiod.hour + 1, minute=0)
max_date += datetime.timedelta(hours=1)
desks = self.agenda.desk_set.all()

View File

@ -1287,3 +1287,23 @@ def test_agenda_day_view(app, admin_user, manager_user, api_user):
agenda.save()
resp = app.get('/manage/agendas/%s/%d/%d/%d/' % (
agenda.id, date.year, date.month, date.day), status=200)
def test_agenda_day_view_late_meeting(app, admin_user, manager_user, api_user):
agenda = Agenda.objects.create(label='New Example', kind='meetings')
desk = Desk.objects.create(agenda=agenda, label='New Desk')
desk.save()
meetingtype = MeetingType(agenda=agenda, label='Bar', duration=30)
meetingtype.save()
today = datetime.date.today()
timeperiod = TimePeriod(desk=desk, weekday=today.weekday(),
start_time=datetime.time(10, 0),
end_time=datetime.time(23, 30))
timeperiod.save()
login(app)
resp = app.get('/manage/agendas/%s/' % agenda.id, status=302).follow()
assert resp.text.count('<tr') == 15
assert '<th>11 p.m.</th>' in resp.text