diff --git a/yc-app-cli/src/main/kotlin/mikufan/cx/yc/cliapp/component/IssuesGetter.kt b/yc-app-cli/src/main/kotlin/mikufan/cx/yc/cliapp/component/IssuesGetter.kt index 898de51..2d30a0f 100644 --- a/yc-app-cli/src/main/kotlin/mikufan/cx/yc/cliapp/component/IssuesGetter.kt +++ b/yc-app-cli/src/main/kotlin/mikufan/cx/yc/cliapp/component/IssuesGetter.kt @@ -32,7 +32,8 @@ class IssuesGetter( "idReadable", "summary", "description", - "customFields(name,id,value(name,id))" + "customFields(name,id,value(name,id,minutes))" // added minutes for the duration value, + // required by AlarmMapper as the string representation can contain an invalid P1W format ) + youtrackFieldNames, customFields = customFieldNames, pageSize = searchConfig.pageSize, diff --git a/yc-core-ical/src/main/kotlin/mikufan/cx/yc/core/ical/component/AlarmMapper.kt b/yc-core-ical/src/main/kotlin/mikufan/cx/yc/core/ical/component/AlarmMapper.kt index 9453e5e..742194d 100644 --- a/yc-core-ical/src/main/kotlin/mikufan/cx/yc/core/ical/component/AlarmMapper.kt +++ b/yc-core-ical/src/main/kotlin/mikufan/cx/yc/core/ical/component/AlarmMapper.kt @@ -18,6 +18,9 @@ import java.time.Duration * 2023-01-03 */ class AlarmMapper { + + companion object { + } fun createAlarm(json: YouTrackIssueJson, alarmSetting: AlarmSetting?): VAlarm? { if (alarmSetting == null) { log.info { "No alarm setting for ${json.debugName}, skipping alarm creation" } @@ -93,8 +96,8 @@ class AlarmMapper { log.debug { "${json.debugName} have empty or null value in the custom field $fieldName for creating alarm" } return null } - val durationString = valueJson["id"].asText() - return Duration.parse(durationString).let { + val durationMinutes = valueJson["minutes"].asLong() + return Duration.ofMinutes(durationMinutes).let { if (isNegative) { it.negated() } else {