From 0e1692d26b43e15017d7be0fb6c4b4ed515b252c Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 3 Jun 2022 19:21:31 -0500 Subject: [PATCH] Fix:Matching authors with multiple authors split by comma #667 --- client/components/modals/item/tabs/Match.vue | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/client/components/modals/item/tabs/Match.vue b/client/components/modals/item/tabs/Match.vue index 05a57279..2d23f128 100644 --- a/client/components/modals/item/tabs/Match.vue +++ b/client/components/modals/item/tabs/Match.vue @@ -366,14 +366,18 @@ export default { }, selectMatch(match) { if (match && match.series) { - match.series = match.series.map((se) => { - return { - id: `new-${Math.floor(Math.random() * 10000)}`, - displayName: se.volumeNumber ? `${se.series} #${se.volumeNumber}` : se.series, - name: se.series, - sequence: se.volumeNumber || '' - } - }) + if (!match.series.length) { + delete match.series + } else { + match.series = match.series.map((se) => { + return { + id: `new-${Math.floor(Math.random() * 10000)}`, + displayName: se.volumeNumber ? `${se.series} #${se.volumeNumber}` : se.series, + name: se.series, + sequence: se.volumeNumber || '' + } + }) + } } this.selectedMatch = match @@ -405,7 +409,9 @@ export default { updatePayload.metadata.series = seriesPayload } else if (key === 'author' && !this.isPodcast) { - if (!Array.isArray(this.selectedMatch[key])) this.selectedMatch[key] = [this.selectedMatch[key]] + if (!Array.isArray(this.selectedMatch[key])) { + this.selectedMatch[key] = this.selectedMatch[key].split(',').map((au) => au.trim()) + } var authorPayload = [] this.selectedMatch[key].forEach((authorName) => authorPayload.push({