Skip to content

Commit 1b2ef80

Browse files
fix(Customers): 등급 기준 변경 시 반영이 안되던 오류를 수정
반복문의 인덱스를 j가 아닌 i를 참조하던 것을 수정
1 parent 8cb91b0 commit 1b2ef80

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/me/smartstore/customer/Customers.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ public void refreshCustomersGroup() {
3232
int totalAmount = currentCustomer.getTotalAmount();
3333

3434
for (int j = 0; j < groupList.size() - 1; j++) {
35-
int currentMinimumHours = groupList.get(i).getParameter().getMinimumHours();
36-
int currentMinimumTotalAmount = groupList.get(i).getParameter().getMinimumTotalAmount();
37-
int nextMinimumHours = groupList.get(i + 1).getParameter().getMinimumHours();
38-
int nextMinimumTotalAmount = groupList.get(i + 1).getParameter().getMinimumTotalAmount();
35+
int currentMinimumHours = groupList.get(j).getParameter().getMinimumHours();
36+
int currentMinimumTotalAmount = groupList.get(j).getParameter().getMinimumTotalAmount();
37+
int nextMinimumHours = groupList.get(j + 1).getParameter().getMinimumHours();
38+
int nextMinimumTotalAmount = groupList.get(j + 1).getParameter().getMinimumTotalAmount();
3939
//어떤 기준도 충족 못시킬 때
4040
if (hours <= currentMinimumHours || totalAmount <= currentMinimumTotalAmount) {
41-
currentCustomer.setGroup(GroupType.getGroupType(0));
42-
return;
41+
currentCustomer.setGroup(GroupType.getGroupType(j));
42+
break;
4343
}
4444
if (hours <= nextMinimumHours && totalAmount <= nextMinimumTotalAmount) {
45-
currentCustomer.setGroup(GroupType.getGroupType(i));
46-
return;
45+
currentCustomer.setGroup(GroupType.getGroupType(j));
46+
break;
4747
}
4848
}
4949
currentCustomer.setGroup(GroupType.getGroupType(groupList.size() - 1));

0 commit comments

Comments
 (0)