Skip to content

Commit

Permalink
fix reporting of starting and nding reservations
Browse files Browse the repository at this point in the history
  • Loading branch information
ptesavol committed Apr 4, 2019
1 parent 6f42ba7 commit 839b3ba
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class TrafficLightsPresenter implements

private int state = -1;

private String previousReservationId = null;
private boolean connected = true;
private boolean reservationChangeInProgess= false;
private boolean tentativeChangeInProgess= false;
Expand Down Expand Up @@ -107,18 +108,23 @@ private void setState(int newState) {
if (this.state == newState)
return;

else if (this.state == STATE_RESERVED && newState != STATE_RESERVED) {
else if (this.state == STATE_RESERVED && (newState != STATE_RESERVED
|| (newState == STATE_RESERVED && this.currentReservation != null && this.currentReservation.getId() != previousReservationId) )) {
this.onReservationEnding();
}

else if (this.state != STATE_RESERVED && newState == STATE_RESERVED) {
else if ((this.state != STATE_RESERVED && newState == STATE_RESERVED)
|| (newState == STATE_RESERVED && this.currentReservation != null && this.currentReservation.getId() != previousReservationId) ) {
this.onReservationStarting();
}

else
this.reportReservationStatus();


if (newState == STATE_RESERVED && this.currentReservation != null)
this.previousReservationId = this.currentReservation.getId();

this.state = newState;
}

Expand Down

0 comments on commit 839b3ba

Please sign in to comment.