From 2c5c3768bf4f2d236c85769f4216c73f846b9e0e Mon Sep 17 00:00:00 2001 From: kwahlin Date: Tue, 21 Nov 2023 09:17:39 +0100 Subject: [PATCH 1/2] Don't append period to work title if no parts to be added after --- .../main/groovy/se/kb/libris/mergeworks/Util.groovy | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy b/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy index e67ba0dd66..ea8a2ad489 100644 --- a/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy +++ b/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy @@ -175,15 +175,9 @@ class Util { ] static void appendTitlePartsToMainTitle(Map title, String partNumber, String partName = null) { - if (title['mainTitle'][-1] != '.') { - title['mainTitle'] += '.' - } - if (partNumber && partName) { - title['mainTitle'] += " $partNumber, $partName" - } else if (partNumber) { - title['mainTitle'] += " $partNumber" - } else if (partName) { - title['mainTitle'] += " $partName" + def part = [partNumber, partName].grep().join(', ') ?: "" + if (part) { + title['mainTitle'] += "${title['mainTitle'][-1] == '.' ? '' : '.'} $part" } } From 824c7eddef4f29ed6377bb39a382d73f9128f521 Mon Sep 17 00:00:00 2001 From: kwahlin Date: Tue, 21 Nov 2023 09:32:05 +0100 Subject: [PATCH 2/2] Remove superfluous code --- librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy b/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy index ea8a2ad489..84cfb00455 100644 --- a/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy +++ b/librisworks/src/main/groovy/se/kb/libris/mergeworks/Util.groovy @@ -175,7 +175,7 @@ class Util { ] static void appendTitlePartsToMainTitle(Map title, String partNumber, String partName = null) { - def part = [partNumber, partName].grep().join(', ') ?: "" + def part = [partNumber, partName].grep().join(', ') if (part) { title['mainTitle'] += "${title['mainTitle'][-1] == '.' ? '' : '.'} $part" }