Changeset 0707e4e


Ignore:
Timestamp:
02/12/22 15:44:00 (2 years ago)
Author:
andrejTavchioski <andrej.tavchioski@…>
Branches:
master
Children:
843a941
Parents:
3b17c69
Message:

fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/app/src/main/java/parkup/services/ParkingSessionService.java

    r3b17c69 r0707e4e  
    4949
    5050        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)
    5252                .collect(Collectors.toList());
    5353    }
     
    110110            throw new IllegalStateException("No such session exists");
    111111        }
    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        }
    115115        int price = session.getParkingZone().getPrice();
    116116        return (int) (Math.ceil(Duration.between(session.getTimeStart(),session.getTimeEnd()).toMinutes()/60.0)*price);
Note: See TracChangeset for help on using the changeset viewer.