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

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