From b5cd979fd5a71b192eb0a157bd53131c61e8a152 Mon Sep 17 00:00:00 2001
From: Anton Suharev
Date: Wed, 7 Aug 2024 20:33:28 -0700
Subject: [PATCH] very minor fixes
---
django/core/jinja2/common.jinja | 2 +-
django/library/views.py | 4 ++++
frontend/src/components/CodebaseListSidebar.vue | 8 +++-----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/django/core/jinja2/common.jinja b/django/core/jinja2/common.jinja
index 40bdd2ee7..0d1f95560 100644
--- a/django/core/jinja2/common.jinja
+++ b/django/core/jinja2/common.jinja
@@ -170,7 +170,7 @@
{{ term }}
{% endfor %}
- clear
+ clear filters
{% endif %}
diff --git a/django/library/views.py b/django/library/views.py
index 93589f3ee..26d9404a3 100644
--- a/django/library/views.py
+++ b/django/library/views.py
@@ -398,6 +398,10 @@ def filter_queryset(self, request, queryset, view):
criteria.update(id__in=filtered_codebase_ids)
if ordering:
criteria.update(ordering=ordering)
+ else:
+ if qs:
+ # set default ordering for search when ordering is not specified
+ criteria.update(ordering="relevance")
return get_search_queryset(qs, queryset, tags=tags, criteria=criteria)
diff --git a/frontend/src/components/CodebaseListSidebar.vue b/frontend/src/components/CodebaseListSidebar.vue
index f20ef351e..19a30ac2c 100644
--- a/frontend/src/components/CodebaseListSidebar.vue
+++ b/frontend/src/components/CodebaseListSidebar.vue
@@ -25,10 +25,8 @@
-
-
+
+
@@ -134,7 +132,7 @@ onMounted(() => {
const initializeFilterValues = () => {
const urlParams = new URLSearchParams(window.location.search);
values.peerReviewStatus = urlParams.get("peerReviewStatus") || "";
- values.programmingLanguages = urlParams.getAll("programmingLanguages") || [];
+ values.programmingLanguages = urlParams.getAll("programmingLanguages").sort() || [];
values.tags = urlParams.getAll("tags").map(tag => ({ name: tag })) || [];
values.startDate = urlParams.get("publishedAfter")
? new Date(urlParams.get("publishedAfter")!)