Skip to content

Commit d079081

Browse files
Aditya SarnaAditya Sarna
authored andcommitted
Filter out 'Moved to other CF' patches from draft commitfest pages
- Exclude patches with STATUS_MOVED from draft CF patch list - Exclude 'Moved to other CF' status from draft CF status summary - Reduces clutter on draft commitfest pages by hiding moved patches When viewing a draft commitfest, patches that have been moved to other commitfests will no longer appear in the patches list or status summary. This only affects draft commitfests; regular commitfests continue to show all patches including moved ones.
1 parent c7088f9 commit d079081

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

pgcommitfest/commitfest/views.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ def patchlist(request, cf, personalized=False):
407407
whereclauses.append("poc.status=ANY(%(openstatuses)s)")
408408
else:
409409
whereclauses.append("poc.commitfest_id=%(cid)s")
410+
# Exclude "Moved to other CF" patches from draft commitfests
411+
if cf.draft:
412+
whereclauses.append("poc.status != %(status_moved)s")
413+
whereparams["status_moved"] = PatchOnCommitFest.STATUS_MOVED
410414

411415
if personalized:
412416
# For now we can just order by these names in descending order, because
@@ -616,12 +620,22 @@ def commitfest(request, cfid):
616620
return patch_list.redirect
617621

618622
# Generate patch status summary.
619-
curs.execute(
620-
"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",
621-
{
622-
"id": cf.id,
623-
},
624-
)
623+
if cf.draft:
624+
# Exclude "Moved to other CF" status from draft commitfests
625+
curs.execute(
626+
"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",
627+
{
628+
"id": cf.id,
629+
"status_moved": PatchOnCommitFest.STATUS_MOVED,
630+
},
631+
)
632+
else:
633+
curs.execute(
634+
"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",
635+
{
636+
"id": cf.id,
637+
},
638+
)
625639
statussummary = curs.fetchall()
626640
statussummary.append([-1, "Total", sum((r[2] for r in statussummary))])
627641

0 commit comments

Comments
 (0)