Skip to content

Commit f978f8c

Browse files
committed
removed sortorder field; multiple fields can be sorted together now
1 parent d03b59e commit f978f8c

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

media/commitfest/js/commitfest.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,13 @@ function flagCommitted(committer) {
221221
}
222222

223223
function sortpatches(sortby) {
224-
if ($('#id_sortkey').val() == sortby) {
225-
if($('#id_sortorder').val() == 1){
226-
$('#id_sortkey').val(0);
227-
$('#id_sortorder').val(0); // reset order
228-
}else if($('#id_sortorder').val() == -1){
229-
$('#id_sortkey').val(sortby);
230-
$('#id_sortorder').val(1); // ascending order -> oldest first
231-
}
224+
let sortkey = $('#id_sortkey').val()
225+
if (sortkey == sortby) {
226+
$('#id_sortkey').val(-sortby)
227+
} else if(-sortkey == sortby){
228+
$('#id_sortkey').val(0)
232229
} else {
233230
$('#id_sortkey').val(sortby);
234-
$('#id_sortorder').val(-1); // descending order -> latest first
235231
}
236232
$('#filterform').submit();
237233

pgcommitfest/commitfest/forms.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ class CommitFestFilterForm(forms.Form):
1717
author = forms.ChoiceField(required=False)
1818
reviewer = forms.ChoiceField(required=False)
1919
sortkey = forms.IntegerField(required=False)
20-
sortorder = forms.IntegerField(required=False) # 0 -> no order, 1 -> asc, -1 -> desc
2120

2221
def __init__(self, cf, *args, **kwargs):
2322
super(CommitFestFilterForm, self).__init__(*args, **kwargs)
2423

2524
self.fields["sortkey"].widget = forms.HiddenInput()
26-
self.fields["sortorder"].widget = forms.HiddenInput()
2725

2826
c = [(-1, "* All")] + list(PatchOnCommitFest._STATUS_CHOICES)
2927
self.fields["status"] = forms.ChoiceField(choices=c, required=False)

pgcommitfest/commitfest/views.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,30 +242,39 @@ def commitfest(request, cfid):
242242

243243
if sortkey == 1:
244244
orderby_str = "modified, created"
245+
elif sortkey == -1:
246+
orderby_str = "modified DESC, created DESC"
245247
elif sortkey == 2:
246248
orderby_str = "lastmail, created"
249+
elif sortkey == -2:
250+
orderby_str = "lastmail DESC, created DESC"
247251
elif sortkey == 3:
248252
orderby_str = "num_cfs DESC, modified, created"
253+
elif sortkey == -3:
254+
orderby_str = "num_cfs ASC, modified DESC, created DESC"
249255
elif sortkey == 4:
250256
orderby_str = "p.id"
257+
elif sortkey == -4:
258+
orderby_str = "p.id DESC"
251259
elif sortkey == 5:
252260
orderby_str = "p.name, created"
261+
elif sortkey == -5:
262+
orderby_str = "p.name DESC, created DESC"
253263
elif sortkey == 6:
254264
orderby_str = (
255265
"branch.all_additions + branch.all_deletions NULLS LAST, created"
256266
)
267+
elif sortkey == -6:
268+
orderby_str = (
269+
"branch.all_additions + branch.all_deletions DESC NULLS LAST, created"
270+
)
257271
else:
258272
orderby_str = "p.id"
259273
sortkey = 0
260274
else:
261275
orderby_str = "topic, created"
262276
sortkey = 0
263277

264-
sortorder = int(request.GET.get("sortorder", "0"))
265-
if sortorder == 1:
266-
orderby_str += " ASC"
267-
elif sortorder == -1:
268-
orderby_str += " DESC"
269278

270279
if not has_filter and sortkey == 0 and request.GET:
271280
# Redirect to get rid of the ugly url
@@ -353,7 +362,6 @@ def commitfest(request, cfid):
353362
"title": cf.title,
354363
"grouping": sortkey == 0,
355364
"sortkey": sortkey,
356-
"sortorder": sortorder,
357365
"openpatchids": [p["id"] for p in patches if p["is_open"]],
358366
"header_activity": "Activity log",
359367
"header_activity_link": "activity/",

0 commit comments

Comments
 (0)