Skip to content

Commit

Permalink
fix: RankAddressUpdateJob 극락 점수 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
thgr8ganzi committed Apr 6, 2024
1 parent f8c4099 commit c16bd96
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/com/core/api/batch/job/RankAddressUpdateJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ public void rankRun() {
BigDecimal latitude = firstItem.getLatitude();
BigDecimal longitude = firstItem.getLongitude();

int score = (itemList.stream()
.mapToInt(item -> (int) calculateScore(item.getType()))
.sum()) / itemList.size();
int score = (int) Math.ceil(
(double) (itemList.stream()
.mapToInt(item -> (int) calculateScore(item.getType()))
.sum() + itemList.size()) / itemList.size());

return RankAddress.builder()
.address(address)
Expand All @@ -65,9 +66,9 @@ private double calculateScore(ItemType type) {
else if (type == ItemType.TYPE2)
return 4;
else if (type == ItemType.TYPE3)
return 3;
return 5;
else if (type == ItemType.TYPE4)
return 2;
return 4;
else
return 1;
}
Expand Down

0 comments on commit c16bd96

Please sign in to comment.