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
This commit is contained in:
Martin Brodbeck 2021-02-15 14:13:38 +01:00
parent a52b8a8288
commit 624987326d
3 changed files with 5 additions and 3 deletions

2
Cargo.lock generated
View file

@ -148,7 +148,7 @@ dependencies = [
[[package]]
name = "pbdbfixer"
version = "0.7.0"
version = "0.7.1"
dependencies = [
"quick-xml",
"rusqlite",

View file

@ -1,6 +1,6 @@
[package]
name = "pbdbfixer"
version = "0.7.0"
version = "0.7.1"
authors = ["Martin Brodbeck <martin@brodbeck-online.de>"]
edition = "2018"

View file

@ -196,7 +196,9 @@ fn fix_db_entries(tx: &Transaction, book_entries: &Vec<BookEntry>) -> Statistics
.iter()
.map(|aut| aut.name.clone())
.collect::<Vec<_>>();
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();