Skip to content

Commit

Permalink
Merge pull request #66 from Team-Haruchi/feat/4-budgetredistribution#3
Browse files Browse the repository at this point in the history
[FIX] 절사 문제 해결
  • Loading branch information
jimmy0524 authored Aug 21, 2024
2 parents 0b3774f + c71b736 commit ffdc44a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public PullMinusClosing pull(BudgetRedistributionRequestDTO.createPullDTO reques
dayBudget.subAmount((int) splitAmount); //467,567 다양하게 있을 수 있음
});

//source day들에서 양수일때만 절사 + target day가 음수에서 양수로 변했을 때의 값 -> 세이프박스
//source day들에서 양수일때만 절사 -> 세이프박스
long safeBoxAmount =
monthBudget.getDayBudgetList().stream()
.filter(dayBudget -> dayBudget.getDay() >= localNowDay && !dayBudget.getDay().equals(targetDay))
Expand All @@ -249,10 +249,13 @@ public PullMinusClosing pull(BudgetRedistributionRequestDTO.createPullDTO reques
}) // 10 단위 이하
.sum();

//target day가 음수에서 양수로 변했을 때의 값 -> 세이프박스
if(targetBudget.getDayBudget() > 0) {
safeBoxAmount += targetBudget.getDayBudget() % 100;
targetBudget.subAmount(targetBudget.getDayBudget() % 100);
}


// 각 sourceday에서 양수일 때 10 단위 이하 금액 절사
monthBudget.getDayBudgetList().stream()
.filter(dayBudget -> dayBudget.getDay() >= localNowDay && !dayBudget.getDay().equals(targetDay))
Expand Down

0 comments on commit ffdc44a

Please sign in to comment.