Skip to content

Commit

Permalink
hotfix: 마감 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekks committed Sep 12, 2024
1 parent 1a7ec97 commit 3fd6ce0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,14 @@ public void create(AnswerListCreateRequest request, Long spaceId, Long retrospec

Answers answers = new Answers(answerRepository.findAllByRetrospectId(retrospectId));

// 마지막 답변이고, 마감일이 지정되지 않은 경우 -> ai 분석 실행
if (answers.getWriteCount(retrospectId) == team.getTeamMemberCount() && !retrospect.hasDeadLine()){
retrospect.updateRetrospectStatus(RetrospectStatus.DONE, time.now());
// 마지막 답변인 경우 -> ai 분석 실행
if (answers.getWriteCount(retrospectId) == team.getTeamMemberCount()){
retrospect.updateAnalysisStatus(AnalysisStatus.PROCEEDING);
retrospectRepository.saveAndFlush(retrospect);

if(!retrospect.hasDeadLine()){
retrospect.updateRetrospectStatus(RetrospectStatus.DONE);
}
retrospectRepository.saveAndFlush(retrospect);

aiAnalyzeService.createAnalyze(spaceId, retrospectId, answers.getWriteMemberIds());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void closeRetrospect(Long spaceId, Long retrospectId, Long memberId) {

Retrospect retrospect = retrospectRepository.findByIdOrThrow(retrospectId);

retrospect.updateRetrospectStatus(RetrospectStatus.DONE, time.now());
retrospect.updateRetrospectStatus(RetrospectStatus.DONE);
retrospect.updateAnalysisStatus(AnalysisStatus.PROCEEDING);
retrospectRepository.saveAndFlush(retrospect);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void updateRetrospectStatusToDone() {
Map<Long, Retrospect> retrospectMap = retrospects.stream()
.collect(Collectors.toMap(Retrospect::getId, retrospect -> retrospect));

retrospects.forEach(retrospect -> retrospect.updateRetrospectStatus(RetrospectStatus.DONE, now));
retrospects.forEach(retrospect -> retrospect.updateRetrospectStatus(RetrospectStatus.DONE));
retrospectRepository.saveAllAndFlush(retrospects);

List<Long> retrospectIds = retrospects.stream().map(Retrospect::getId).toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,9 @@ public void updateRetrospect(String title, String introduction, LocalDateTime de
this.deadline = deadline;
}

public void updateRetrospectStatus(RetrospectStatus retrospectStatus, LocalDateTime now) {
public void updateRetrospectStatus(RetrospectStatus retrospectStatus) {
isProceedingRetrospect();

if (this.deadline != null && now.isBefore(this.deadline)) {
return;
}

this.retrospectStatus = retrospectStatus;
}

Expand Down

0 comments on commit 3fd6ce0

Please sign in to comment.