From 2b49e64123c01a37d24a5713fbc233e0e0598745 Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Fri, 6 Oct 2023 22:40:38 +0100 Subject: [PATCH] Hide total line for weeks with no work done --- app/views/attendance_tracker/index.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/attendance_tracker/index.html.erb b/app/views/attendance_tracker/index.html.erb index c841344..b48eee3 100644 --- a/app/views/attendance_tracker/index.html.erb +++ b/app/views/attendance_tracker/index.html.erb @@ -29,9 +29,13 @@
+ <% total_for_week = lectures.sum { |lecture| lecture.total_overall_time }.seconds %> <%# TODO: Improve this figure, atm it is for lectures in week, not time spent in week (ie prepping for lecture next week will count in next week not current week) %> - (Total <%= humanise_duration(lectures.sum { |lecture| lecture.total_overall_time }.seconds) %>) + <% if total_for_week > 0 %> + (Total <%= humanise_duration(lectures.sum { |lecture| lecture.total_overall_time }.seconds) %> + ) + <% end %>