diff --git a/.idea/artifacts/marudor_client_jvm.xml b/.idea/artifacts/marudor_client_jvm.xml deleted file mode 100644 index 35f84c1..0000000 --- a/.idea/artifacts/marudor_client_jvm.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - $PROJECT_DIR$/marudor-client/build/libs - - - - - \ No newline at end of file diff --git a/bot/src/main/kotlin/dev/schlaubi/hafalsch/bot/ui/CoachPlan.kt b/bot/src/main/kotlin/dev/schlaubi/hafalsch/bot/ui/CoachPlan.kt index 0298c70..1153906 100644 --- a/bot/src/main/kotlin/dev/schlaubi/hafalsch/bot/ui/CoachPlan.kt +++ b/bot/src/main/kotlin/dev/schlaubi/hafalsch/bot/ui/CoachPlan.kt @@ -50,7 +50,7 @@ fun Coach.findPlan(trainType: String, parent: CoachGroup): String? { currentUic != null ) { val type = buildString { - append(currentUic[4]) + append(currentUic.substr(4, 5)) if (identifier.endsWith('R')) { append(".r") } else if (".S" in identifier) { @@ -64,3 +64,5 @@ fun Coach.findPlan(trainType: String, parent: CoachGroup): String? { } private fun fullUrl(type: String) = "https://lib.finalrewind.org/dbdb/db_wagen/$type.png" + +private fun CharSequence.substr(start: Int, length: Int) = substring(start, start + length) diff --git a/marudor-client/src/commonMain/kotlin/dev/schlaubi/hafalsch/marudor/Marudor.kt b/marudor-client/src/commonMain/kotlin/dev/schlaubi/hafalsch/marudor/Marudor.kt index 7067d96..ff5cf8f 100644 --- a/marudor-client/src/commonMain/kotlin/dev/schlaubi/hafalsch/marudor/Marudor.kt +++ b/marudor-client/src/commonMain/kotlin/dev/schlaubi/hafalsch/marudor/Marudor.kt @@ -70,7 +70,7 @@ public class Marudor(public val resoures: ClientResources) { return resoures.client.post(HafasRoute.V2.JourneyMatch(profile)) { contentType(ContentType.Application.Json) setBody(HafasJourneyMatchRequest(name, initialDepartureDate, filters, onlyRT)) - }.body() + }.safeBody() ?: emptyList() } /**