fix: changed wrong conditions

This commit is contained in:
filippo-ferrari 2024-09-07 21:55:00 +02:00
parent 3e016d2bf9
commit 13d5f1bf29

View file

@ -13,7 +13,6 @@ import javax.annotation.Nonnull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -141,10 +140,10 @@ public class ExpenseService {
* @param expense the expense to set the type of * @param expense the expense to set the type of
*/ */
private void setExpenseType(final @Nonnull Expense expense) { private void setExpenseType(final @Nonnull Expense expense) {
if (Objects.nonNull(expense.getCreditors()) && !expense.getCreditors().isEmpty()) if (!expense.getCreditors().isEmpty())
// If creditors are present, set type to CREDIT // If creditors are present, set type to CREDIT
expense.setExpenseType(ExpenseType.CREDIT); expense.setExpenseType(ExpenseType.CREDIT);
else if (Objects.nonNull(expense.getDebtors()) && !expense.getDebtors().isEmpty()) else if (!expense.getDebtors().isEmpty())
// If debtors are present and no creditors, set type to DEBIT // If debtors are present and no creditors, set type to DEBIT
expense.setExpenseType(ExpenseType.DEBIT); expense.setExpenseType(ExpenseType.DEBIT);
else else