From bf662f3c396da73b6c1a65a07c34a59616c678c1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 16:21:05 +0000 Subject: [PATCH 1/3] Initial plan From 97d73c92902fee83500167bb1d6a885c17e6455c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 16:31:49 +0000 Subject: [PATCH 2/3] Filter STATUS_MOVED patches from draft CF pages Co-authored-by: Aditya-Sarna <107273722+Aditya-Sarna@users.noreply.github.com> --- pgcommitfest/commitfest/views.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 12cd8a6f..ae3fb640 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -407,6 +407,9 @@ 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") if personalized: # For now we can just order by these names in descending order, because @@ -541,6 +544,7 @@ def patchlist(request, cf, personalized=False): params = { "openstatuses": PatchOnCommitFest.OPEN_STATUSES, "cid": cf.id, + "status_moved": PatchOnCommitFest.STATUS_MOVED, } params.update(whereparams) @@ -616,12 +620,22 @@ def commitfest(request, cfid): return patch_list.redirect # Generate patch status summary. - 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", - { - "id": cf.id, - }, - ) + if cf.draft: + # Exclude "Moved to other CF" status from draft commitfests + 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 AND poc.status != %(status_moved)s GROUP BY ps.status ORDER BY ps.sortkey", + { + "id": cf.id, + "status_moved": PatchOnCommitFest.STATUS_MOVED, + }, + ) + 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", + { + "id": cf.id, + }, + ) statussummary = curs.fetchall() statussummary.append([-1, "Total", sum((r[2] for r in statussummary))]) From af53832571f593e794b76f2136cf12c9b4160bf5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 16:34:42 +0000 Subject: [PATCH 3/3] Refactor status summary query to reduce code duplication Co-authored-by: Aditya-Sarna <107273722+Aditya-Sarna@users.noreply.github.com> --- pgcommitfest/commitfest/views.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index ae3fb640..db81e955 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -620,22 +620,16 @@ def commitfest(request, cfid): return patch_list.redirect # Generate patch status summary. + status_query = "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_params = {"id": cf.id} + if cf.draft: # Exclude "Moved to other CF" status from draft commitfests - 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 AND poc.status != %(status_moved)s GROUP BY ps.status ORDER BY ps.sortkey", - { - "id": cf.id, - "status_moved": PatchOnCommitFest.STATUS_MOVED, - }, - ) - 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", - { - "id": cf.id, - }, - ) + status_query += " AND poc.status != %(status_moved)s" + status_params["status_moved"] = PatchOnCommitFest.STATUS_MOVED + + status_query += " GROUP BY ps.status ORDER BY ps.sortkey" + curs.execute(status_query, status_params) statussummary = curs.fetchall() statussummary.append([-1, "Total", sum((r[2] for r in statussummary))])