Changeset 0707e4e for sources/app/src
- Timestamp:
- 02/12/22 15:44:00 (3 years ago)
- Branches:
- master
- Children:
- 843a941
- Parents:
- 3b17c69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/services/ParkingSessionService.java
r3b17c69 r0707e4e 49 49 50 50 return parkingSessionRepository.findAll().stream() 51 .filter(s->!s.getStatus().equals(SessionStatus.ENDED_PAID) && s.getParkingZone() .getId()==pzId)51 .filter(s->!s.getStatus().equals(SessionStatus.ENDED_PAID) && s.getParkingZone()!=null && s.getParkingZone().getId()==pzId) 52 52 .collect(Collectors.toList()); 53 53 } … … 110 110 throw new IllegalStateException("No such session exists"); 111 111 } 112 //else if(session.getStatus()!= SessionStatus.ENDED_PAID){113 // throw new IllegalStateException("Cannot calculate payment on a paid session");114 //}112 else if(session.getStatus()!= SessionStatus.ENDED_PAID){ 113 throw new IllegalStateException("Cannot calculate payment on a session that is not ended"); 114 } 115 115 int price = session.getParkingZone().getPrice(); 116 116 return (int) (Math.ceil(Duration.between(session.getTimeStart(),session.getTimeEnd()).toMinutes()/60.0)*price);
Note:
See TracChangeset
for help on using the changeset viewer.