N+1 in Boards::IssuesController#index

I see that we have a lot of queries like:

SELECT SUM("timelogs"."time_spent") FROM "timelogs" WHERE "timelogs"."issue_id" = $1 

This is due to IssueBoardEntity including TimeTrackableEntity which results to the exposure of total_time_spent. I don't think we display this in the UI so I think we can remove the include and only expose the attributes we need. (time_estimate and human_time_estimate)

Another problem I see with TimeTrackableEntity is that it does this query twice per issue. One for total_time_spent and another for human_total_time_spent. We should probably memoize this in the model.

Assignee Loading
Time tracking Loading