Skip to content

Commit

Permalink
FIX: 더미 데이터 판별 시 status, category가 아닌 user로 판별
Browse files Browse the repository at this point in the history
  • Loading branch information
saewoo1 committed Oct 29, 2024
1 parent e241438 commit 17aef86
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,21 @@ public class Presentation {
private User user;

protected Presentation(Category category, LocalDateTime dateTime,
PresentationTime presentationTime, String subject, String summary, String detail,
PresentationStatus status) {
PresentationTime presentationTime, String subject, String summary, String detail) {
this.category = category;
this.dateTime = dateTime;
this.presentationTime = presentationTime;
this.subject = subject;
this.detail = detail;
this.summary = summary;
this.presentationStatus = status;
this.presentationStatus = PresentationStatus.EXPECTED;
this.presentationLocation = PresentationLocation.BASEMENT;
}

public static Presentation of(Category category, LocalDateTime dateTime,
PresentationTime presentationTime, String subject, String summary, String detail,
PresentationStatus status) {
PresentationTime presentationTime, String subject, String summary, String detail) {

return new Presentation(category, dateTime, presentationTime, subject, summary, detail,
status);
return new Presentation(category, dateTime, presentationTime, subject, summary, detail);
}

public void adminUpdate(PresentationStatus newStatus, LocalDateTime newDateTime,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.ftclub.cabinet.presentation.domain;

public enum PresentationStatus {
CANCEL, DONE, EXPECTED, DUMMY
CANCEL, DONE, EXPECTED
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ public List<Presentation> getRegisteredPresentations(LocalDateTime start, LocalD

return presentations.stream()
.filter(presentation ->
!presentation.getPresentationStatus().equals(PresentationStatus.CANCEL)
&& !presentation.getPresentationStatus()
.equals(PresentationStatus.DUMMY)
presentation.getPresentationStatus().equals(PresentationStatus.EXPECTED)
&& presentation.getUser() != null
)
.collect(Collectors.toList());
}
Expand All @@ -49,7 +48,7 @@ public Presentation getOneDummyByDate(LocalDateTime dateTime) {
LocalDateTime endOfDate = dateTime.withHour(23).withMinute(59).withSecond(59);
return presentationRepository.findAllByDateTimeBetween(startOfDate, endOfDate)
.stream()
.filter(p -> p.getPresentationStatus() == PresentationStatus.DUMMY)
.filter(p -> p.getCategory() == Category.DUMMY)
.findFirst()
.orElseThrow(ExceptionStatus.INVALID_PRESENTATION_DATE::asServiceException);
}
Expand All @@ -63,11 +62,10 @@ public List<Presentation> getDummyDateBetweenMonth(
LocalDateTime localDateTime) {

List<Presentation> presentations =
presentationRepository.findAllByDateTimeBetween(now, localDateTime);
presentationRepository.findAllByDateTimeBetweenOrderByDateTime(now, localDateTime);

return presentations.stream()
.filter(presentation ->
presentation.getCategory().equals(Category.DUMMY))
.filter(presentation -> presentation.getUser() == null)
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ public void updatePresentationByFormId(Long formId, PresentationUpdateDto dto) {
PresentationTime.HALF,
"dummy",
"dummy",
"dummy",
PresentationStatus.DUMMY);
"dummy");
presentationRepository.save(presentation);
}

Expand Down Expand Up @@ -251,8 +250,7 @@ public void generatePresentationFormsEveryThreeMonth(LocalDate nowDate) {
PresentationTime.HALF,
"dummy",
"dummy",
"dummy",
PresentationStatus.DUMMY
"dummy"
))
.collect(Collectors.toList());

Expand Down

0 comments on commit 17aef86

Please sign in to comment.