diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 12cd8a6f..35d42ed1 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -407,6 +407,10 @@ def patchlist(request, cf, personalized=False): whereclauses.append("poc.status=ANY(%(openstatuses)s)") else: whereclauses.append("poc.commitfest_id=%(cid)s") + # Exclude "Moved to other CF" patches from draft commitfests + if cf.draft: + whereclauses.append("poc.status != %(status_moved)s") + whereparams["status_moved"] = PatchOnCommitFest.STATUS_MOVED if personalized: # For now we can just order by these names in descending order, because @@ -616,10 +620,13 @@ def commitfest(request, cfid): return patch_list.redirect # Generate patch status summary. + # Exclude "Moved to other CF" status from draft commitfests + status_filter = "AND poc.status != %(status_moved)s" if cf.draft else "" curs.execute( - "SELECT ps.status, ps.statusstring, count(*) FROM commitfest_patchoncommitfest poc INNER JOIN commitfest_patchstatus ps ON ps.status=poc.status WHERE commitfest_id=%(id)s GROUP BY ps.status ORDER BY ps.sortkey", + f"SELECT ps.status, ps.statusstring, count(*) FROM commitfest_patchoncommitfest poc INNER JOIN commitfest_patchstatus ps ON ps.status=poc.status WHERE commitfest_id=%(id)s {status_filter} GROUP BY ps.status ORDER BY ps.sortkey", { "id": cf.id, + "status_moved": PatchOnCommitFest.STATUS_MOVED, }, ) statussummary = curs.fetchall()