@ -27,14 +27,14 @@ See doc/COPYRIGHT.md for more details.
<%
entries = TimeEntry
.where(["#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", @user.id, Date.today - 6, Date.today])
.includes([:activity, :project, {:work_package => [:type, :status]}])
.where(["#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", @user.id, Date.today - 6, Date.today]).references(:projects)
.order("#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Type.table_name}.position ASC, #{WorkPackage.table_name}.id ASC")
entries_by_day = entries.group_by(&:spent_on)
%>
<div class="total-hours">
<p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(& :hours).to_f) %></p>
<p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(:hours).to_f) %></p>
</div>
<% if entries.any? %>