Fix:Error adding new series if a series has a null title #3622

This commit is contained in:
advplyr 2024-11-18 07:59:02 -06:00
parent 778256ca16
commit a5e38d1473
3 changed files with 7 additions and 4 deletions

View File

@ -71,8 +71,6 @@ export default {
this.showSeriesForm = true
},
submitSeriesForm() {
console.log('submit series form', this.value, this.selectedSeries)
if (!this.selectedSeries.name) {
this.$toast.error('Must enter a series')
return

View File

@ -29,7 +29,12 @@ class BookMetadata {
this.subtitle = metadata.subtitle
this.authors = metadata.authors?.map ? metadata.authors.map((a) => ({ ...a })) : []
this.narrators = metadata.narrators ? [...metadata.narrators].filter((n) => n) : []
this.series = metadata.series?.map ? metadata.series.map((s) => ({ ...s })) : []
this.series = metadata.series?.map
? metadata.series.map((s) => ({
...s,
name: s.name || 'No Title'
}))
: []
this.genres = metadata.genres ? [...metadata.genres] : []
this.publishedYear = metadata.publishedYear || null
this.publishedDate = metadata.publishedDate || null

View File

@ -662,7 +662,7 @@ module.exports = {
},
attributes: ['id', 'name']
})
series.forEach((s) => data.series.push({ id: s.id, name: s.name }))
series.forEach((s) => data.series.push({ id: s.id, name: s.name || 'No Title' }))
const authors = await Database.authorModel.findAll({
where: {