@@ -117,6 +117,13 @@ def commitfest(request, cfid):
117117 # int() failed -- so just ignore this filter
118118 pass
119119
120+ if request .GET .get ('targetversion' , '-1' ) != '-1' :
121+ if request .GET ['targetversion' ] == '-2' :
122+ whereclauses .append ("targetversion_id IS NULL" )
123+ else :
124+ whereparams ['verid' ] = int (request .GET ['targetversion' ])
125+ whereclauses .append ("targetversion_id=%(verid)s" )
126+
120127 if request .GET .get ('author' , '-1' ) != '-1' :
121128 if request .GET ['author' ] == '-2' :
122129 whereclauses .append ("NOT EXISTS (SELECT 1 FROM commitfest_patch_authors cpa WHERE cpa.patch_id=p.id)" )
@@ -193,7 +200,7 @@ def commitfest(request, cfid):
193200
194201 # Let's not overload the poor django ORM
195202 curs = connection .cursor ()
196- curs .execute ("""SELECT p.id, p.name, poc.status, p.created, p.modified, p.lastmail, committer.username AS committer, t.topic,
203+ curs .execute ("""SELECT p.id, p.name, poc.status, v.version AS targetversion, p.created, p.modified, p.lastmail, committer.username AS committer, t.topic,
197204(poc.status=ANY(%(openstatuses)s)) AS is_open,
198205(SELECT string_agg(first_name || ' ' || last_name || ' (' || username || ')', ', ') FROM auth_user INNER JOIN commitfest_patch_authors cpa ON cpa.user_id=auth_user.id WHERE cpa.patch_id=p.id) AS author_names,
199206(SELECT string_agg(first_name || ' ' || last_name || ' (' || username || ')', ', ') FROM auth_user INNER JOIN commitfest_patch_reviewers cpr ON cpr.user_id=auth_user.id WHERE cpr.patch_id=p.id) AS reviewer_names,
@@ -202,8 +209,9 @@ def commitfest(request, cfid):
202209INNER JOIN commitfest_patchoncommitfest poc ON poc.patch_id=p.id
203210INNER JOIN commitfest_topic t ON t.id=p.topic_id
204211LEFT JOIN auth_user committer ON committer.id=p.committer_id
212+ LEFT JOIN commitfest_targetversion v ON p.targetversion_id=v.id
205213WHERE poc.commitfest_id=%(cid)s {0}
206- GROUP BY p.id, poc.id, committer.id, t.id
214+ GROUP BY p.id, poc.id, committer.id, t.id, v.version
207215ORDER BY is_open DESC, {1}""" .format (where_str , orderby_str ), params )
208216 patches = [dict (zip ([col [0 ] for col in curs .description ], row )) for row in curs .fetchall ()]
209217
0 commit comments