From 33a05a759026cad186a0b432eaa6fa78cfb7cb08 Mon Sep 17 00:00:00 2001 From: Jan Cizmar Date: Wed, 28 Jun 2023 12:01:02 +0200 Subject: [PATCH] fix: Import collision handling (#1768) --- .../tolgee/service/dataImport/CoreImportFilesProcessor.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/data/src/main/kotlin/io/tolgee/service/dataImport/CoreImportFilesProcessor.kt b/backend/data/src/main/kotlin/io/tolgee/service/dataImport/CoreImportFilesProcessor.kt index ad6cbbe02c..8365a51967 100644 --- a/backend/data/src/main/kotlin/io/tolgee/service/dataImport/CoreImportFilesProcessor.kt +++ b/backend/data/src/main/kotlin/io/tolgee/service/dataImport/CoreImportFilesProcessor.kt @@ -146,10 +146,10 @@ class CoreImportFilesProcessor( private fun FileProcessorContext.processTranslations() { this.translations.forEach { entry -> val keyEntity = getOrCreateKey(entry.key) - entry.value.forEach { newTranslation -> + entry.value.forEach translationForeach@{ newTranslation -> val storedTranslations = importDataManager.getStoredTranslations(keyEntity, newTranslation.language) newTranslation.key = keyEntity - if (storedTranslations.size > 1) { + if (storedTranslations.size > 0) { storedTranslations.forEach { collidingTranslations -> fileEntity.addIssue( FileIssueType.MULTIPLE_VALUES_FOR_KEY_AND_LANGUAGE, @@ -159,7 +159,7 @@ class CoreImportFilesProcessor( ) ) } - return + return@translationForeach } this@CoreImportFilesProcessor.addToStoredTranslations(newTranslation) }