Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:cvazquezlos/BREMS-Library-App into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jherel committed Apr 22, 2017
2 parents d98c0fb + a7be246 commit 70b0bea
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions backend/src/main/java/appSpring/model/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ protected Action() {

public Action(Date dateLoanInit) {
this.dateLoanInit = dateLoanInit;
dateLoanReturn = new Date(0);
dateLoanGiven = new Date(0);
}

public Integer getID() {
Expand Down
12 changes: 6 additions & 6 deletions backend/src/main/java/appSpring/service/LogicService.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private boolean hasEnoughCopies(Resource resource) {
private boolean hasAnActiveAction(User user, Resource resource) {
List<Action> 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;
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -184,10 +184,10 @@ public int addReturnDate(Action action, Date date) {
List<Action> 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();
Expand Down
Binary file modified backend/target/appSpring-0.0.1.jar
Binary file not shown.
Binary file modified backend/target/appSpring-0.0.1.jar.original
Binary file not shown.
Binary file modified backend/target/classes/appSpring/model/Action.class
Binary file not shown.
Binary file modified backend/target/classes/appSpring/service/LogicService.class
Binary file not shown.

0 comments on commit 70b0bea

Please sign in to comment.