Skip to content

Commit

Permalink
feat: 스파크 날짜가 이전이면 카운트 세지 않도록 변경 (#73)
Browse files Browse the repository at this point in the history
* feat: Spark 엔티티에 채팅url 추가, 관련 api 적용 (#14)

* feat: 스파크 날짜가 이전이면 카운트 세지 않도록 변경 (#14)
  • Loading branch information
ympark99 authored Oct 15, 2023
1 parent 02aecd1 commit 9b036f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.onna.onnaback.domain.place.adapter.out.persistence;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -88,16 +89,16 @@ private Long calculateSparkCount(Place place, SparkType sparkType,
Long sparkCnt = (long) place.getSparkList().size();

for (Spark spark : sparks) {
if (sparkType != null && spark.getType() != sparkType) {
// 스파크 날짜가 이전이면 카운트 x
if (spark.getSparkDate().isBefore(LocalDateTime.now())) {
sparkCnt--;
continue;
}
if (durationHour != null && spark.getDurationHour() != durationHour) {
} else if (sparkType != null && spark.getType() != sparkType) {
sparkCnt--;
} else if (durationHour != null && spark.getDurationHour() != durationHour) {
sparkCnt--;
continue;
}
// 모집중
if (sortType == SortType.RECRUITING && spark.getRecruitType() != RecruitType.RECRUITING) {
// 모집중 아닌 경우
else if (sortType == SortType.RECRUITING && spark.getRecruitType() != RecruitType.RECRUITING) {
sparkCnt--;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public Spark getById(Long sparkId) {
public List<SparkResponse> getSparkListByPlaceId(Long placeId) {
return sparkRepository.findSparksByPlace(placeId)
.stream().map(spark -> SparkResponse.builder().sparkId(spark.getSparkId())

.img(spark.getImg())
.title(spark.getTitle())
.durationHour(spark.getDurationHour())
Expand Down

0 comments on commit 9b036f0

Please sign in to comment.