Skip to content

Commit

Permalink
Merge pull request #3380 from moia-oss/fix_prebooking_abandonment
Browse files Browse the repository at this point in the history
Fix prebookig abandonment bug
  • Loading branch information
nkuehnel authored Jul 23, 2024
2 parents 9e934d4 + aea22bd commit 2a40907
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ public PrebookingStopActivity(PassengerHandler passengerHandler, DynAgent driver
@Override
protected boolean isLastStep(double now) {
boolean dropoffsReady = updateDropoffRequests(now);
boolean pickupsReady = updatePickupRequests(now);
boolean pickupsReady = updatePickupRequests(now, false);
return pickupsReady && dropoffsReady && now >= endTime.get();
}

@Override
protected void beforeFirstStep(double now) {
initDropoffRequests(now);
updatePickupRequests(now);
updatePickupRequests(now, true);
}

private void initDropoffRequests(double now) {
Expand Down Expand Up @@ -112,7 +112,7 @@ public int compareTo(QueuedRequest o) {
}
}

private boolean updatePickupRequests(double now) {
private boolean updatePickupRequests(double now, boolean isFirstStep) {
var pickupIterator = pickupRequests.values().iterator();

while (pickupIterator.hasNext()) {
Expand All @@ -125,7 +125,7 @@ private boolean updatePickupRequests(double now) {
if (passengerHandler.notifyWaitForPassengers(this, this.driver, request.getId())) {
// agent starts to enter
queuePickup(request, now);
} else if (now > request.getEarliestStartTime()) {
} else if (now > request.getEarliestStartTime() && !isFirstStep) {
if (abandonVoter.abandonRequest(now, vehicle, request)) {
prebookingManager.abandon(request.getId());
}
Expand Down

0 comments on commit 2a40907

Please sign in to comment.