Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Fix issues in Coach plan detection
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Jul 11, 2022
1 parent 3d72a59 commit d936b70
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
8 changes: 0 additions & 8 deletions .idea/artifacts/marudor_client_jvm.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

/**
Expand Down

0 comments on commit d936b70

Please sign in to comment.