Fix n+1 issues in dashboards and index views