manager: don't show booking colours of cancelled bookings (#81110)
gitea/chrono/pipeline/head This commit looks good Details

This commit is contained in:
Serghei Mihai 2023-09-12 12:52:14 +02:00
parent 93081c6e46
commit 5fe881fdb5
2 changed files with 8 additions and 1 deletions

View File

@ -1337,7 +1337,7 @@ class AgendaDateView(DateMixin, ViewableAgendaMixin):
except ValueError: # no meeting types defined
context['hour_span'] = 1
context['booking_colors'] = BookingColor.objects.filter(
bookings__event__in=self.object_list
bookings__event__in=self.object_list, bookings__cancellation_datetime__isnull=True
).distinct()
context['user_can_manage'] = self.agenda.can_be_managed(self.request.user)
return context

View File

@ -3794,6 +3794,13 @@ def test_agenda_booking_colors(app, admin_user, api_user, view):
assert 'Booking colors:' in resp.text
assert len(resp.pyquery.find('div.booking-colors span.booking-color-label')) == 2
new_booking.cancel()
resp = app.get(url)
assert len(resp.pyquery.find('div.booking')) == 3
assert len(resp.pyquery.find('div.booking.booking-color-%s' % new_booking.color.index)) == 0
assert resp.text.count('Swimming') == 0 # no booking and no legend
assert len(resp.pyquery.find('div.booking-colors span.booking-color-label')) == 1
@freezegun.freeze_time('2022-03-01 14:00')
def test_agenda_day_and_month_views_weekday_indexes(app, admin_user):