Skip to content

Commit f994c10

Browse files
committed
no more grace period for arrive by
1 parent ac8b748 commit f994c10

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ android {
2525
applicationId = "com.cornellappdev.transit"
2626
minSdk = 26
2727
targetSdk = 36
28-
versionCode = 10
29-
versionName = "2.0"
28+
versionCode = 11
29+
versionName = "2.1"
3030

3131
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3232
vectorDrawables {

app/src/main/java/com/cornellappdev/transit/util/RouteOptionsDisplayProcessor.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ private fun Route.effectiveArrivalInstantOrNull(
258258
return endInstant.plusSeconds(delaySeconds.toLong())
259259
}
260260

261-
/** True when route arrives on or before provided cutoff (including grace already applied by caller). */
261+
/** True when route arrives on or before provided cutoff (strict, no grace period). */
262262
private fun Route.arrivesBy(
263-
cutoffWithGrace: Instant,
263+
cutoff: Instant,
264264
diagnostics: RouteProcessingDiagnostics? = null,
265265
): Boolean {
266266
val arrivalInstant = effectiveArrivalInstantOrNull(diagnostics) ?: return false
267-
return !arrivalInstant.isAfter(cutoffWithGrace)
267+
return !arrivalInstant.isAfter(cutoff)
268268
}
269269

270270
/** Comparator for Arrive By ordering: latest departure first, then shorter distance. */
@@ -333,18 +333,16 @@ private fun compareByEffectiveLeaveTime(
333333

334334
/**
335335
* Section-level Arrive By filtering and ordering.
336-
* Keeps routes that arrive by cutoff (with grace), then sorts by latest departure first.
336+
* Keeps routes that arrive by cutoff, then sorts by latest departure first.
337337
*/
338338
private fun List<Route>?.filterAndSortRoutesForArriveBy(
339339
cutoff: Instant,
340340
diagnostics: RouteProcessingDiagnostics? = null,
341341
): List<Route>? {
342342
if (this == null) return null
343343

344-
val cutoffWithGrace = cutoff.plus(Duration.ofMinutes(ARRIVE_BY_CUTOFF_GRACE_MINUTES))
345-
346344
return this
347-
.filter { route -> route.arrivesBy(cutoffWithGrace, diagnostics) }
345+
.filter { route -> route.arrivesBy(cutoff, diagnostics) }
348346
.sortedWith(::compareArriveByRoutes)
349347
}
350348

app/src/main/java/com/cornellappdev/transit/util/TransitConstants.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const val LEAVE_CUTOFF_HORIZON_MINUTES = 45L
2222

2323
const val LEAVE_CUTOFF_GRACE_MINUTES = 2L
2424

25-
const val ARRIVE_BY_CUTOFF_GRACE_MINUTES = 2L
2625

2726
// Hide transit options when walking arrives at the same time or sooner (+ tie buffer).
2827
const val WALKING_TRANSIT_TIE_MINUTES = 1L

0 commit comments

Comments
 (0)