mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-31 08:14:40 +02:00
Fix:Duplicate series and authors being added on matches and scans #2106
This commit is contained in:
parent
0aae672e19
commit
d18592eaeb
3 changed files with 16 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
const { DataTypes, Model, literal } = require('sequelize')
|
||||
const { DataTypes, Model, where, fn, col } = require('sequelize')
|
||||
|
||||
const oldAuthor = require('../objects/entities/Author')
|
||||
|
||||
|
@ -114,14 +114,11 @@ class Author extends Model {
|
|||
static async getOldByNameAndLibrary(authorName, libraryId) {
|
||||
const author = (await this.findOne({
|
||||
where: [
|
||||
literal(`name = ':authorName' COLLATE NOCASE`),
|
||||
where(fn('lower', col('name')), authorName.toLowerCase()),
|
||||
{
|
||||
libraryId
|
||||
}
|
||||
],
|
||||
replacements: {
|
||||
authorName
|
||||
}
|
||||
]
|
||||
}))?.getOldAuthor()
|
||||
return author
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue