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:
parent
a52b8a8288
commit
624987326d
3 changed files with 5 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -148,7 +148,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pbdbfixer"
|
name = "pbdbfixer"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pbdbfixer"
|
name = "pbdbfixer"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
authors = ["Martin Brodbeck <martin@brodbeck-online.de>"]
|
authors = ["Martin Brodbeck <martin@brodbeck-online.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,9 @@ fn fix_db_entries(tx: &Transaction, book_entries: &Vec<BookEntry>) -> Statistics
|
||||||
.iter()
|
.iter()
|
||||||
.map(|aut| aut.name.clone())
|
.map(|aut| aut.name.clone())
|
||||||
.collect::<Vec<_>>();
|
.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
|
let mut stmt = tx
|
||||||
.prepare("UPDATE books_impl SET author = :authors WHERE id = :book_id")
|
.prepare("UPDATE books_impl SET author = :authors WHERE id = :book_id")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue