mirror of
https://github.com/adityachandelgit/BookLore.git
synced 2026-01-06 07:39:48 -06:00
consider series name when sorting books (#1123)
This commit is contained in:
@@ -673,7 +673,15 @@ export class BookBrowserComponent implements OnInit {
|
||||
const forceExpandSeries = this.shouldForceExpandSeries();
|
||||
return this.headerFilter.filter(bookState).pipe(
|
||||
switchMap(filtered => this.sideBarFilter.filter(filtered)),
|
||||
switchMap(filtered => this.seriesCollapseFilter.filter(filtered, forceExpandSeries))
|
||||
switchMap(filtered => this.seriesCollapseFilter.filter(filtered, forceExpandSeries)),
|
||||
map(filtered =>
|
||||
(filtered.loaded && !filtered.error)
|
||||
? ({
|
||||
...filtered,
|
||||
books: this.sortService.applySort(filtered.books || [], this.bookSorter.selectedSort!)
|
||||
})
|
||||
: filtered
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import {SortDirection, SortOption} from "../model/sort.model";
|
||||
export class SortService {
|
||||
|
||||
private readonly fieldExtractors: Record<string, (book: Book) => any> = {
|
||||
title: (book) => book.metadata?.title?.toLowerCase() || null,
|
||||
title: (book) => (book.seriesCount ? (book.metadata?.seriesName?.toLowerCase() || null) : null)
|
||||
?? (book.metadata?.title?.toLowerCase() || null),
|
||||
titleSeries: (book) => {
|
||||
const title = book.metadata?.title?.toLowerCase() || '';
|
||||
const series = book.metadata?.seriesName?.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user