diff --git a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt index 4d9d5aad..6af02ca3 100644 --- a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt +++ b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraDataService.kt @@ -109,9 +109,13 @@ class JiraDataService( * @param imsProject The IMSProject to work with * @return the IssueType */ - suspend fun issueType(imsProject: IMSProject): IssueType { + suspend fun issueType(imsProject: IMSProject, name: String): IssueType { val template = issueTemplate(imsProject) val imsProjectConfig = IMSProjectConfig(helper, imsProject) + val namedType = template.issueTypes().firstOrNull { it.name == name } + if (namedType != null) { + return namedType + } if (imsProjectConfig.defaultType != null) { val type = neoOperations.findById(imsProjectConfig.defaultType) if ((type != null) && (type.partOf().contains(template))) { diff --git a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt index 885f0a16..89b1b4bd 100644 --- a/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt +++ b/sync-jira/src/main/kotlin/gropius/sync/jira/JiraSync.kt @@ -129,7 +129,7 @@ final class JiraSync( override suspend fun fetchData(imsProjects: List) { for (imsProject in imsProjects) { jiraDataService.issueTemplate(imsProject) - jiraDataService.issueType(imsProject) + jiraDataService.issueType(imsProject, "") jiraDataService.issueState(imsProject, null, true) jiraDataService.issueState(imsProject, null, false) } diff --git a/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt b/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt index 35ecf263..f49183ee 100644 --- a/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt +++ b/sync-jira/src/main/kotlin/gropius/sync/jira/model/IssueData.kt @@ -428,7 +428,8 @@ data class IssueData( issue.state().value = jiraService.issueState(imsProject, null, true) issue.template().value = jiraService.issueTemplate(imsProject) issue.trackables() += jiraService.neoOperations.findAll(Project::class.java).awaitFirst() - issue.type().value = jiraService.issueType(imsProject) + issue.type().value = + jiraService.issueType(imsProject, fields["issuetype"]?.jsonObject?.get("name")?.jsonPrimitive?.content!!) return issue } }