From ed32c4a48f5436d5e7e9774cef79cef8de266182 Mon Sep 17 00:00:00 2001 From: Akshat Jaimini Date: Sun, 16 Feb 2025 17:37:36 +0530 Subject: [PATCH 1/4] feature: added reverse sorting --- media/commitfest/js/commitfest.js | 15 +++++++++------ pgcommitfest/commitfest/views.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/media/commitfest/js/commitfest.js b/media/commitfest/js/commitfest.js index 27a54f94..99b3f021 100644 --- a/media/commitfest/js/commitfest.js +++ b/media/commitfest/js/commitfest.js @@ -257,12 +257,15 @@ function flagCommitted(committer) { } function sortpatches(sortby) { - if ($("#id_sortkey").val() === sortby) { - $("#id_sortkey").val(0); - } else { - $("#id_sortkey").val(sortby); - } - $("#filterform").submit(); + let sortkey = $('#id_sortkey').val() + if (sortkey == sortby) { + $('#id_sortkey').val(-sortby) + } else if(-sortkey == sortby){ + $('#id_sortkey').val(0) + } else { + $('#id_sortkey').val(sortby); + } + $('#filterform').submit(); return false; } diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 1f0df87d..0ad74a39 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -241,18 +241,32 @@ def commitfest(request, cfid): if sortkey == 1: orderby_str = "modified, created" + elif sortkey == -1: + orderby_str = "modified DESC, created DESC" elif sortkey == 2: orderby_str = "lastmail, created" + elif sortkey == -2: + orderby_str = "lastmail DESC, created DESC" elif sortkey == 3: orderby_str = "num_cfs DESC, modified, created" + elif sortkey == -3: + orderby_str = "num_cfs ASC, modified DESC, created DESC" elif sortkey == 4: orderby_str = "p.id" + elif sortkey == -4: + orderby_str = "p.id DESC" elif sortkey == 5: orderby_str = "p.name, created" + elif sortkey == -5: + orderby_str = "p.name DESC, created DESC" elif sortkey == 6: orderby_str = ( "branch.all_additions + branch.all_deletions NULLS LAST, created" ) + elif sortkey == -6: + orderby_str = ( + "branch.all_additions + branch.all_deletions DESC NULLS LAST, created" + ) else: orderby_str = "p.id" sortkey = 0 From 2f0473cb42c4e270db607f0be04942d98ff98236 Mon Sep 17 00:00:00 2001 From: Akshat Jaimini Date: Sun, 16 Feb 2025 19:50:32 +0530 Subject: [PATCH 2/4] Added up arrow for reverse sort --- pgcommitfest/commitfest/templates/commitfest.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pgcommitfest/commitfest/templates/commitfest.html b/pgcommitfest/commitfest/templates/commitfest.html index aee8af9f..ac5b17de 100644 --- a/pgcommitfest/commitfest/templates/commitfest.html +++ b/pgcommitfest/commitfest/templates/commitfest.html @@ -60,18 +60,18 @@

{{p.is_open|yesno:"Active patches,Closed patches"}}

- - + + - + - - - + + + {%if user.is_staff%} {%endif%} From 79d714a7eccd05ff1b17b9c23b599781e121776c Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sun, 16 Feb 2025 22:40:27 +0100 Subject: [PATCH 3/4] Apply changes from biome formatter/linter --- media/commitfest/js/commitfest.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/media/commitfest/js/commitfest.js b/media/commitfest/js/commitfest.js index 99b3f021..2d6b0b8f 100644 --- a/media/commitfest/js/commitfest.js +++ b/media/commitfest/js/commitfest.js @@ -257,15 +257,15 @@ function flagCommitted(committer) { } function sortpatches(sortby) { - let sortkey = $('#id_sortkey').val() - if (sortkey == sortby) { - $('#id_sortkey').val(-sortby) - } else if(-sortkey == sortby){ - $('#id_sortkey').val(0) - } else { - $('#id_sortkey').val(sortby); - } - $('#filterform').submit(); + const sortkey = $("#id_sortkey").val(); + if (sortkey === sortby) { + $("#id_sortkey").val(-sortby); + } else if (-sortkey === sortby) { + $("#id_sortkey").val(0); + } else { + $("#id_sortkey").val(sortby); + } + $("#filterform").submit(); return false; } From f8ec4126c35a4fc578d3e1220241f51bbc733ac4 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sun, 16 Feb 2025 22:45:19 +0100 Subject: [PATCH 4/4] Add missing DESC --- pgcommitfest/commitfest/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 0ad74a39..152d39b5 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -264,9 +264,7 @@ def commitfest(request, cfid): "branch.all_additions + branch.all_deletions NULLS LAST, created" ) elif sortkey == -6: - orderby_str = ( - "branch.all_additions + branch.all_deletions DESC NULLS LAST, created" - ) + orderby_str = "branch.all_additions + branch.all_deletions DESC NULLS LAST, created DESC" else: orderby_str = "p.id" sortkey = 0
Patch{%if sortkey == 5%}
{%endif%}
ID{%if sortkey == 4%}
{%endif%}
Patch{%if sortkey == 5%}
{%elif sortkey == -5%}
{%endif%}
ID{%if sortkey == 4%}
{%elif sortkey == -4%}
{%endif%}
Status Ver CI statusStats{%if sortkey == 6%}
{%endif%}
Stats{%if sortkey == 6%}
{%elif sortkey == -6%}
{%endif%}
Author Reviewers CommitterNum cfs{%if sortkey == 3%}
{%endif%}
Latest activity{%if sortkey == 1%}
{%endif%}
Latest mail{%if sortkey == 2%}
{%endif%}
Num cfs{%if sortkey == 3%}
{%elif sortkey == -3%}
{%endif%}
Latest activity{%if sortkey == 1%}
{%elif sortkey == -1%}
{%endif%}
Latest mail{%if sortkey == 2%}
{%elif sortkey == -2%}
{%endif%}
Select