Add fb2 parser
This commit is contained in:
@@ -160,10 +160,12 @@ impl Repository<book::Book, BookFilter> for BookRepository {
|
||||
|
||||
fn filter(&self, f: BookFilter) -> Box<dyn Iterator<Item = book::Book>> {
|
||||
let mut author_ids: Vec<String> = vec![];
|
||||
let mut use_author = false;
|
||||
|
||||
if let Some(author) = f.author {
|
||||
if let Some(id) = author.id {
|
||||
author_ids.push(id);
|
||||
use_author = true;
|
||||
}
|
||||
|
||||
if let Some(name) = author.name {
|
||||
@@ -175,12 +177,13 @@ impl Repository<book::Book, BookFilter> for BookRepository {
|
||||
&& author.clone().middle_name.unwrap().contains(&name))
|
||||
{
|
||||
author_ids.push(id.to_string());
|
||||
use_author = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if author_ids.is_empty() {
|
||||
if author_ids.is_empty() && use_author {
|
||||
return Box::new(std::iter::empty::<book::Book>())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user