diff --git a/backend/src/main/java/appSpring/model/Action.java b/backend/src/main/java/appSpring/model/Action.java index 3b461f3..bbdd951 100644 --- a/backend/src/main/java/appSpring/model/Action.java +++ b/backend/src/main/java/appSpring/model/Action.java @@ -58,8 +58,6 @@ protected Action() { public Action(Date dateLoanInit) { this.dateLoanInit = dateLoanInit; - dateLoanReturn = new Date(0); - dateLoanGiven = new Date(0); } public Integer getID() { diff --git a/backend/src/main/java/appSpring/service/LogicService.java b/backend/src/main/java/appSpring/service/LogicService.java index 3b1b3a3..82e727a 100644 --- a/backend/src/main/java/appSpring/service/LogicService.java +++ b/backend/src/main/java/appSpring/service/LogicService.java @@ -55,7 +55,7 @@ private boolean hasEnoughCopies(Resource resource) { private boolean hasAnActiveAction(User user, Resource resource) { List actions = user.getActions(); for (Action action : actions) { - if (action.getResource().getResource() == resource && action.getDateLoanReturn() == new Date(0)) { + if (action.getResource().getResource() == resource && action.getDateLoanReturn() == null) { return true; } } @@ -105,7 +105,7 @@ public Action getAction() { } private boolean deleteLoanAvaible(Action loan) { - return (loan.getDateLoanReturn() == new Date(0)); + return (loan.getDateLoanReturn() == null); } public int deleteALoan(Action loan) { @@ -143,11 +143,11 @@ public int createAnUser(User user) { } private boolean itIsPossibleToReturn(Action action) { - return ((action.getDateLoanGiven() != new Date(0)) && (action.getDateLoanReturn() == new Date(0))); + return ((action.getDateLoanGiven() != null) && (action.getDateLoanReturn() == null)); } private boolean itIsPossibleToGive(Action action) { - return ((action.getDateLoanGiven() == new Date(0)) && (action.getDateLoanReturn() == new Date(0))); + return ((action.getDateLoanGiven() == null) && (action.getDateLoanReturn() == null)); } public int addGiveDate(Action action, Date date) { @@ -184,10 +184,10 @@ public int addReturnDate(Action action, Date date) { List currentActions = actionService.findByUser(action.getUser()); for (Action currentAction : currentActions) { Date date1 = currentAction.getDateLoanGiven(); - if (date1 == new Date(0)) + if (date1 == null) continue; Date date3 = currentAction.getDateLoanReturn(); - if (date3 != new Date(0)) + if (date3 != null) continue; date1.setMinutes(date1.getMinutes() + 1); Date date2 = new Date(); diff --git a/backend/target/appSpring-0.0.1.jar b/backend/target/appSpring-0.0.1.jar index 3b3b4ef..4d8902e 100644 Binary files a/backend/target/appSpring-0.0.1.jar and b/backend/target/appSpring-0.0.1.jar differ diff --git a/backend/target/appSpring-0.0.1.jar.original b/backend/target/appSpring-0.0.1.jar.original index 0a900ee..867217a 100644 Binary files a/backend/target/appSpring-0.0.1.jar.original and b/backend/target/appSpring-0.0.1.jar.original differ diff --git a/backend/target/classes/appSpring/model/Action.class b/backend/target/classes/appSpring/model/Action.class index 2b688a5..3bbb864 100644 Binary files a/backend/target/classes/appSpring/model/Action.class and b/backend/target/classes/appSpring/model/Action.class differ diff --git a/backend/target/classes/appSpring/service/LogicService.class b/backend/target/classes/appSpring/service/LogicService.class index 0bb43da..39c58fa 100644 Binary files a/backend/target/classes/appSpring/service/LogicService.class and b/backend/target/classes/appSpring/service/LogicService.class differ