make root filter work with children's books
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c30052bac7
commit
43c3a25758
@ -100,10 +100,11 @@ function apiResponseParsing(book) {
|
||||
|
||||
function search(books, searchBy, includeChildrensBooks) {
|
||||
searchBy = searchCleaner(searchBy);
|
||||
if (searchBy !== "") {
|
||||
books = books.filter(
|
||||
({ title, authors, genre, publisher, series, year, childrens }) => {
|
||||
var inSearch = Object.values({
|
||||
var inSearch = true;
|
||||
if (searchBy !== "") {
|
||||
inSearch = Object.values({
|
||||
title,
|
||||
authors: authors.join(" "),
|
||||
genre,
|
||||
@ -111,13 +112,13 @@ function search(books, searchBy, includeChildrensBooks) {
|
||||
series,
|
||||
year,
|
||||
}).find((field) => searchCleaner(field).indexOf(searchBy) !== -1);
|
||||
}
|
||||
if (!includeChildrensBooks) {
|
||||
return inSearch && !childrens;
|
||||
}
|
||||
return inSearch;
|
||||
}
|
||||
);
|
||||
}
|
||||
return books;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user