Browse Source

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
master v0.7.1
Martin Brodbeck 1 year ago
parent
commit
624987326d
  1. 2
      Cargo.lock
  2. 2
      Cargo.toml
  3. 4
      src/main.rs

2
Cargo.lock generated

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

2
Cargo.toml

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

4
src/main.rs

@ -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();

Loading…
Cancel
Save