From 8fa1667285d5015fe1a318bbfdd0f6fb8fd7c268 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Tue, 20 Jun 2023 18:22:30 +0200 Subject: [PATCH] change ratio computation --- chrono/manager/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrono/manager/views.py b/chrono/manager/views.py index b095f9ed..f9cdbe68 100644 --- a/chrono/manager/views.py +++ b/chrono/manager/views.py @@ -1510,7 +1510,11 @@ class AgendaDayView(AgendaDateView, DayArchiveView): context['hours'] = [datetime.time(hour=i) for i in range(start_time.hour, end_time.hour)] def get_time_ratio(t1, t2): - return 100 * ((t1.hour - t2.hour) * 60 + t1.minute - t2.minute) // 60 + return ( + 100 + * ((t1.hour - t2.hour) * 60 + t1.minute - t2.minute) + // (end_time.hour * 60 + end_time.minute - (start_time.hour * 60 + start_time.minute)) + ) bookings = Booking.objects.filter(event__in=events) bookings_by_user = collections.defaultdict(list)