Lecture
Date
Status
Action
Recording
<% course.lectures.sort_by(&:start_time).group_by(&:week_number).each do |(week_number, lectures)| %>
Week <%= week_number %>
<% 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) %> <% if total_for_week > 0 %> (Total <%= humanise_duration(lectures.sum { |lecture| lecture.total_overall_time }.seconds) %>) <% end %>
<%= render lectures %> <% end %>