Skip to content

Commit

Permalink
Merge branch 'revert-pr-288' into live-tracking-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Jan 28, 2025
2 parents c07d302 + 62b583a commit 7c9f553
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ public boolean shouldSkipMonitoredTripCheck(boolean persist) throws Exception {

// Attempt to advance to the next monitored day, except for one-time trips
// or if tracking is ongoing or if the matching itinerary is still valid.
if (!trip.isOneTime() && !isTrackingOngoing() && !isMatchingItineraryStartTimeInTheFuture()) {
if (!trip.isOneTime() && !isTrackingOngoing()) {
advanceToNextMonitoredDay();
}

Expand Down Expand Up @@ -874,6 +874,13 @@ private void advanceToNextMonitoredDay() {
}
}

initializeTargetZonedDateTime();

// advance the trip to the next active date
advanceToNextActiveTripDate();
}

private void initializeTargetZonedDateTime() {
// Check if the CheckMonitoredTrip is being ran for the first time for this trip and if the trip's saved
// itinerary has already ended. Additionally, make sure that the saved itinerary occurred on the same
// service day. If both of these conditions are true, then there is no need to
Expand All @@ -885,9 +892,6 @@ private void advanceToNextMonitoredDay() {
) {
targetZonedDateTime = targetZonedDateTime.plusDays(1);
}

// advance the trip to the next active date
advanceToNextActiveTripDate();
}

/** Check if the previous matching itinerary was null or if it has already concluded */
Expand Down Expand Up @@ -948,6 +952,14 @@ private void advanceToNextActiveTripDate() {

LOG.info("Next matching itinerary starts at {}", matchingItinerary.startTime);

resetJourneyState();

// reset the snoozed parameter to false
trip.snoozed = false;
updateTripStatus();
}

private void resetJourneyState() {
// update journey state with baseline departure and arrival times which are the last known departure/arrival
journeyState.baselineDepartureTimeEpochMillis = matchingItinerary.startTime.getTime();
journeyState.baselineArrivalTimeEpochMillis = matchingItinerary.endTime.getTime();
Expand All @@ -960,10 +972,6 @@ private void advanceToNextActiveTripDate() {
// resent journey state's realtime data to be false as it has just been manually advanced without having checked
// the trip planner for realtime data
journeyState.hasRealtimeData = false;

// reset the snoozed parameter to false
trip.snoozed = false;
updateTripStatus();
}

/**
Expand Down

0 comments on commit 7c9f553

Please sign in to comment.