Skip to content

Commit

Permalink
search: update oredering of results
Browse files Browse the repository at this point in the history
Signed-off-by: pamfilos <[email protected]>
  • Loading branch information
pamfilos committed Aug 27, 2024
1 parent bcf8e32 commit 57d71bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scoap3/articles/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def __init__(self, *args, **kwargs):
"article_identifiers.identifier_value",
)

ordering_fields = {"_updated_at": "_updated_at"}
ordering = ["-_updated_at"]
ordering_fields = {"publication_date": "publication_date"}
ordering = ["publication_date"]

filter_fields = {
"publication_year": {
Expand Down
4 changes: 3 additions & 1 deletion scoap3/articles/tests/test_article_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def test_create_article_from_workflow(self, client, user, shared_datadir):
== "The Effective QCD Running Coupling Constant and a Dirac Model for the Charmonium Spectrum"
)

def test_create_article_from_workflow_with_large_text(self, client, user, shared_datadir):
def test_create_article_from_workflow_with_large_text(
self, client, user, shared_datadir
):
client.force_login(user)
contents = (shared_datadir / "workflow_record_with_large_text.json").read_text()
data = json.loads(contents)
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const SearchResults: React.FC<SearchResultsProps> = ({
const sortOptions = [
{
label: "Most recent",
value: "_updated_at",
value: "-publication_date",
},
{
label: "Least recent",
value: "-_updated_at",
value: "publication_date",
},
];

Expand All @@ -55,7 +55,7 @@ const SearchResults: React.FC<SearchResultsProps> = ({
options={sortOptions}
className="sort-dropdown ml-3"
onChange={sortResults}
defaultValue="_updated_at"
defaultValue="-publication_date"
>
<Select.OptGroup>
<DownOutlined />
Expand Down

0 comments on commit 57d71bb

Please sign in to comment.