@@ -144,9 +144,13 @@ def awaiting_reviews(self, submissions):
144144 }
145145
146146 def active_invoices (self ):
147- invoices = Invoice .objects .filter (
148- project__lead = self .request .user ,
149- ).in_progress ()
147+ invoices = (
148+ Invoice .objects .filter (
149+ project__lead = self .request .user ,
150+ )
151+ .in_progress ()
152+ .select_related ("project" , "by" )
153+ )
150154
151155 return {
152156 "count" : invoices .count (),
@@ -160,13 +164,18 @@ def projects(self):
160164 data = self .request .GET or None , request = self .request , queryset = projects
161165 )
162166
167+ filtered_qs = filterset .qs
168+
163169 limit = 10
170+ limited_qs = list (filtered_qs [: limit + 1 ])
171+ has_more = len (limited_qs ) > limit
172+ table_data = limited_qs [:limit ]
164173
165174 return {
166- "count" : projects .count (),
175+ "count" : filtered_qs .count (),
167176 "filterset" : filterset ,
168- "table" : ProjectsDashboardTable (data = projects [: limit ] , prefix = "project-" ),
169- "display_more" : projects . count () > limit ,
177+ "table" : ProjectsDashboardTable (data = table_data , prefix = "project-" ),
178+ "display_more" : has_more ,
170179 "url" : reverse ("apply:projects:all" ),
171180 }
172181
@@ -492,6 +501,7 @@ def active_invoices(self):
492501 )
493502 return {"count" : active_invoices .count (), "data" : active_invoices }
494503
504+ # todo: if we don't need, we can remove these historical tables
495505 def historical_project_data (self ):
496506 historical_projects = (
497507 Project .objects .filter (user = self .request .user ).complete ().for_table ()
0 commit comments