Skip to content

Filter STATUS_MOVED patches from draft CF pages#1

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/remove-moved-to-other-cf-section
Draft

Filter STATUS_MOVED patches from draft CF pages#1
Copilot wants to merge 3 commits intomainfrom
copilot/remove-moved-to-other-cf-section

Conversation

Copy link

Copilot AI commented Dec 23, 2025

Removes "Moved to other CF" patches from draft commitfest page views to reduce clutter. These patches have been moved to other commitfests and are no longer relevant to the draft CF.

Changes Made

1. Patch List Query (patchlist function)

Added conditional filter in views.py to exclude STATUS_MOVED patches when viewing draft CFs:

if cf.draft:
    whereclauses.append("poc.status != %(status_moved)s")

2. Status Summary Query (commitfest function)

Modified query building in views.py to conditionally exclude STATUS_MOVED from the status summary for draft CFs:

status_query = "SELECT ... WHERE commitfest_id=%(id)s"
if cf.draft:
    status_query += " AND poc.status != %(status_moved)s"
status_query += " GROUP BY ps.status ORDER BY ps.sortkey"

3. Parameter Addition

Added status_moved parameter to the params dict for use in queries.

How It Works

Before: Draft CF pages showed all patches including those with "Moved to different CF" status, cluttering the view with patches that are no longer relevant.

After: Draft CF pages now filter out STATUS_MOVED patches in both:

  • The main patch list display
  • The status summary counts at the top of the page

Regular (non-draft) commitfests continue to show all patches including moved ones, maintaining existing behavior for those views.

Testing

  • ✅ Code review completed - addressed code duplication feedback
  • ✅ Security scan passed - no vulnerabilities found
  • ✅ Python syntax validated
Original prompt

The "Moved to other CF" status just clutters the view on the draft CF page. At least those should not be visible. Maybe remove the whole section. does the pgcommitfest forked pr draft solve for this


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 23, 2025
@Aditya-Sarna
Copy link
Owner

@copilot # 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,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,
        },
    )is this solution apt check red and green portion in commit draft

Co-authored-by: Aditya-Sarna <107273722+Aditya-Sarna@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 23, 2025

@copilot # Exclude "Moved to other CF" patches from draft commitfests
if cf.draft:
whereclauses.append("poc.status != %(status_moved)s")...

Yes, this solution is appropriate. The changes accomplish two things:

  1. Filter patches in the list: Excludes STATUS_MOVED patches from draft CFs in the patchlist query
  2. Filter status summary: Excludes STATUS_MOVED from the status counts displayed at the top of draft CF pages

This ensures consistency - if moved patches aren't shown in the list, they shouldn't be counted in the summary either. The filtering only applies to draft CFs where moved patches are clutter, while regular CFs continue to show all patches including moved ones.

Implemented in commit 97d73c9.

Co-authored-by: Aditya-Sarna <107273722+Aditya-Sarna@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove moved to other CF section from draft CF page Filter STATUS_MOVED patches from draft CF pages Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants