manager: display at least a period in week/month views (#72617)
gitea-wip/chrono/pipeline/pr-main This commit looks good Details

This commit is contained in:
Frédéric Péters 2022-12-20 08:49:19 +01:00
parent 6ef8117a05
commit e05bfbf546
2 changed files with 20 additions and 0 deletions

View File

@ -1515,6 +1515,9 @@ class AgendaWeekMonthMixin:
interval = datetime.timedelta(minutes=60)
period = self.date.replace(hour=self.min_display.hour, minute=0)
max_date = self.date.replace(hour=self.max_display.hour, minute=0)
if period == max_date:
# add at least an interval
max_date = max_date + interval
periods = []
while period < max_date:

View File

@ -1739,6 +1739,23 @@ def test_agenda_month_view_weekend(app, admin_user, kind):
assert 'Saturday' in resp.text
def test_agenda_meetings_view_opening_not_even_an_hour(app, admin_user):
month, year = 1, 2019
monday = 0
agenda = Agenda.objects.create(label='Passeports', kind='meetings')
desk = Desk.objects.create(agenda=agenda, label='Desk A')
TimePeriod.objects.create(
desk=desk, weekday=monday, start_time=datetime.time(10, 0), end_time=datetime.time(10, 30)
)
login(app)
resp = app.get('/manage/agendas/%s/%s/%s/' % (agenda.id, year, month))
assert resp.pyquery('.opening-hours').length == 4 # four weeks
resp = app.get('/manage/agendas/%s/%s/week/10/' % (agenda.id, year))
assert resp.pyquery('.opening-hours').length == 1
@pytest.mark.parametrize('kind', ['meetings', 'virtual'])
def test_agenda_month_view_dst_change(app, admin_user, kind):
if kind == 'meetings':