fix journal search result ordering
This commit is contained in:
parent
a08554f289
commit
eba417648c
4 changed files with 604 additions and 524 deletions
|
@ -178,7 +178,11 @@ class JournalSearchResult(SearchResult):
|
|||
[],
|
||||
)
|
||||
)
|
||||
items = Item.objects.filter(pk__in=ids, is_deleted=False)
|
||||
select = {f"id_{i}": f"id={i}" for i in ids}
|
||||
order = [f"-id_{i}" for i in ids]
|
||||
items = Item.objects.filter(pk__in=ids, is_deleted=False).extra(
|
||||
select=select, order_by=order
|
||||
)
|
||||
items = [j for j in [i.final_item for i in items] if not j.is_deleted]
|
||||
return items
|
||||
|
||||
|
@ -197,7 +201,9 @@ class JournalSearchResult(SearchResult):
|
|||
],
|
||||
[],
|
||||
)
|
||||
ps = Piece.objects.filter(pk__in=ids)
|
||||
select = {f"id_{i}": f"id={i}" for i in ids}
|
||||
order = [f"-id_{i}" for i in ids]
|
||||
ps = Piece.objects.filter(pk__in=ids).extra(select=select, order_by=order)
|
||||
return ps
|
||||
|
||||
@cached_property
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load i18n %}
|
||||
<aside class="grid__aside bottom">
|
||||
<p>
|
||||
{% trans 'Addtional filters may be added to query' %}
|
||||
<details open>
|
||||
<summary>{% trans 'Search filters' %}</summary>
|
||||
<li>
|
||||
<code>status:complete</code> - {% trans 'filter by one of these statuses' %}: <code>wishlist</code> / <code>progress</code> / <code>complete</code> / <code>dropped</code>
|
||||
</li>
|
||||
|
@ -29,5 +29,8 @@
|
|||
<li>
|
||||
<code>date:2022..2023</code> - {% trans 'filter by date range' %}
|
||||
</li>
|
||||
</p>
|
||||
<li>
|
||||
<code>sort:date</code> - {% trans "sort by one of these fields" %}: <code>date</code> ({% trans "from new to old" %}) / <code>rating</code> ({% trans "from high to low" %})
|
||||
</li>
|
||||
</details>
|
||||
</aside>
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue