Skip to content

Commit 4f72169

Browse files
committed
Add an "Open" filter
The Drafts CF can theoretically accumulate a large number of closed items. Add a filter that encompasses all open statuses so that Drafts will be able to use it as a default.
1 parent 9bc4ea1 commit 4f72169

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pgcommitfest/commitfest/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, data, *args, **kwargs):
2727

2828
self.fields["sortkey"].widget = forms.HiddenInput()
2929

30-
c = [(-1, "* All")] + list(PatchOnCommitFest._STATUS_CHOICES)
30+
c = [(-1, "* All"), (-2, "* Open")] + list(PatchOnCommitFest._STATUS_CHOICES)
3131
self.fields["status"] = forms.ChoiceField(choices=c, required=False)
3232

3333
userchoices = [(-1, "* All"), (-2, "* None"), (-3, "* Yourself")]

pgcommitfest/commitfest/views.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,15 @@ def patchlist(request, cf, personalized=False):
246246
whereparams = {}
247247

248248
if request.GET.get("status", "-1") != "-1":
249-
try:
250-
whereparams["status"] = int(request.GET["status"])
251-
whereclauses.append("poc.status=%(status)s")
252-
except ValueError:
253-
# int() failed -- so just ignore this filter
254-
pass
249+
if request.GET["status"] == "-2":
250+
whereclauses.append("poc.status=ANY(%(openstatuses)s)")
251+
else:
252+
try:
253+
whereparams["status"] = int(request.GET["status"])
254+
whereclauses.append("poc.status=%(status)s")
255+
except ValueError:
256+
# int() failed -- so just ignore this filter
257+
pass
255258

256259
if request.GET.get("targetversion", "-1") != "-1":
257260
if request.GET["targetversion"] == "-2":

0 commit comments

Comments
 (0)