Skip to content

Commit

Permalink
#16 [Fix] 업장 리스트 DTO의 소수점 표시 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JSoi committed Jul 27, 2022
1 parent 5c7725c commit 0542219
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PACKAGE)
@Getter @Setter
@Getter
@Setter
@Builder
@Slf4j
public class StoreCardResponseDto {
Expand All @@ -29,7 +30,7 @@ public class StoreCardResponseDto {
private String phoneNumber;
private String heightDifferent;
private String approach;
private List<StoreImgResponseDto> storeImgList;
private List<String> storeImgList;
private int bookmarkCount;
private String bookmark;

Expand Down Expand Up @@ -66,10 +67,11 @@ public StoreCardResponseDto(Store store, String isBookMark) {
this.heightDifferent = store.getHeightDifferent();
this.approach = store.getApproach();
this.bookmarkCount = store.getBookMarkCount();
this.storeImgList = store.getStoreImageList().parallelStream()
.map(StoreImgResponseDto::new).collect(Collectors.toList());
this.pointAvg = Double.parseDouble(String.format(store.getReviewList().stream()
.collect(Collectors.averagingDouble(Review::getPoint)).toString(), 0.1f));
this.storeImgList = new ArrayList<>();
store.getStoreImageList().parallelStream()
.forEachOrdered(s -> storeImgList.add(s.getStoreImageUrl()));
double hap = store.getReviewList().stream().map(Review::getPoint).mapToDouble(Double::doubleValue).sum();
this.pointAvg = store.getReviewList().size() == 0 ? 0 : Double.parseDouble(String.format("%1.1f", (hap / store.getReviewList().size())));
this.bookmark = isBookMark;
}
}

0 comments on commit 0542219

Please sign in to comment.