From 624987326deb0b580cb5a268123e21a3e4b949bc Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 15 Feb 2021 14:13:38 +0100 Subject: [PATCH] Also remove "false positive" authors If PB adds an author who doesn't have the "aut"-role, make sure to remove this false-positive entry --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fccaaa4..09beae3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,7 +148,7 @@ dependencies = [ [[package]] name = "pbdbfixer" -version = "0.7.0" +version = "0.7.1" dependencies = [ "quick-xml", "rusqlite", diff --git a/Cargo.toml b/Cargo.toml index 1f36995..03226d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pbdbfixer" -version = "0.7.0" +version = "0.7.1" authors = ["Martin Brodbeck "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index b2cc8b6..318f53d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -196,7 +196,9 @@ fn fix_db_entries(tx: &Transaction, book_entries: &Vec) -> Statistics .iter() .map(|aut| aut.name.clone()) .collect::>(); - if !authornames.iter().all(|s| entry.author.contains(s)) { + if !authornames.iter().all(|s| entry.author.contains(s)) + || authornames.join(", ").len() != entry.author.len() + { let mut stmt = tx .prepare("UPDATE books_impl SET author = :authors WHERE id = :book_id") .unwrap();