@@ -137,9 +137,13 @@ def awaiting_reviews(self, submissions):
137137 }
138138
139139 def active_invoices (self ):
140- invoices = Invoice .objects .filter (
141- project__lead = self .request .user ,
142- ).in_progress ()
140+ invoices = (
141+ Invoice .objects .filter (
142+ project__lead = self .request .user ,
143+ )
144+ .in_progress ()
145+ .select_related ("project" , "by" )
146+ )
143147
144148 return {
145149 "count" : invoices .count (),
@@ -153,13 +157,18 @@ def projects(self):
153157 data = self .request .GET or None , request = self .request , queryset = projects
154158 )
155159
160+ filtered_qs = filterset .qs
161+
156162 limit = 10
163+ limited_qs = list (filtered_qs [: limit + 1 ])
164+ has_more = len (limited_qs ) > limit
165+ table_data = limited_qs [:limit ]
157166
158167 return {
159- "count" : projects .count (),
168+ "count" : filtered_qs .count (),
160169 "filterset" : filterset ,
161- "table" : ProjectsDashboardTable (data = projects [: limit ] , prefix = "project-" ),
162- "display_more" : projects . count () > limit ,
170+ "table" : ProjectsDashboardTable (data = table_data , prefix = "project-" ),
171+ "display_more" : has_more ,
163172 "url" : reverse ("apply:projects:all" ),
164173 }
165174
@@ -481,6 +490,7 @@ def active_invoices(self):
481490 )
482491 return {"count" : active_invoices .count (), "data" : active_invoices }
483492
493+ # todo: if we don't need, we can remove these historical tables
484494 def historical_project_data (self ):
485495 historical_projects = (
486496 Project .objects .filter (user = self .request .user ).complete ().for_table ()
0 commit comments