From 0cdb2a6e1e109ab4281d216034e7ebca513afde8 Mon Sep 17 00:00:00 2001 From: ch8930 Date: Fri, 22 Nov 2024 01:40:07 +0900 Subject: [PATCH] bug: TT-510 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 문단별 시간 계산 오류 --- .../peech/paragraph/application/ParagraphService.java | 9 +++++---- .../paragraph/infrastructure/ParagraphFetcherImpl.java | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/twentythree/peech/paragraph/application/ParagraphService.java b/src/main/java/com/twentythree/peech/paragraph/application/ParagraphService.java index fc0d48c..1fd6128 100644 --- a/src/main/java/com/twentythree/peech/paragraph/application/ParagraphService.java +++ b/src/main/java/com/twentythree/peech/paragraph/application/ParagraphService.java @@ -13,13 +13,14 @@ import lombok.RequiredArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.cglib.core.Local; import org.springframework.stereotype.Service; import java.time.LocalTime; import java.util.ArrayList; import java.util.List; +import static com.twentythree.peech.common.utils.ScriptUtils.*; + @RequiredArgsConstructor @Service public class ParagraphService { @@ -46,14 +47,14 @@ public List getKeyWordsByScriptId(Long scriptId) { public HistoryDetailResponseDTO getScriptDetail(Long scriptId) { ParagraphsInformationDomain paragraphsInformationDomain = paragraphFetcher.fetchParagraphsInformation(scriptId); List paragraphInformations = paragraphsInformationDomain.getParagraphInformations(); - LocalTime totalRealTime = LocalTime.of(0, 0, 0); + LocalTime totalRealTime = LocalTime.of(0, 0, 0, 0); List historyParagraphs = new ArrayList<>(); for(ParagraphInformation paragraphInformation : paragraphInformations) { - String measurement = ScriptUtils.measurementSpeedResult(paragraphInformation.getParagraphRealTime(), + String measurement = measurementSpeedResult(paragraphInformation.getParagraphRealTime(), paragraphInformation.getParagraphExpectedTime()); - totalRealTime = ScriptUtils.sumLocalTime(totalRealTime, paragraphInformation.getParagraphRealTime()); + totalRealTime = sumLocalTime(totalRealTime, paragraphInformation.getParagraphRealTime()); historyParagraphs.add(new HistoryParagraphDTO(paragraphInformation.getParagraphOrder(), measurement, paragraphInformation.getParagraphRealTime(), paragraphInformation.getParagraphContent())); diff --git a/src/main/java/com/twentythree/peech/paragraph/infrastructure/ParagraphFetcherImpl.java b/src/main/java/com/twentythree/peech/paragraph/infrastructure/ParagraphFetcherImpl.java index 946d829..3210928 100644 --- a/src/main/java/com/twentythree/peech/paragraph/infrastructure/ParagraphFetcherImpl.java +++ b/src/main/java/com/twentythree/peech/paragraph/infrastructure/ParagraphFetcherImpl.java @@ -86,9 +86,13 @@ public ParagraphsInformationDomain fetchParagraphsInformation(Long scriptId) { else if (paragraphOrder > latestParagraphOrder) { paragraphInformations.add(new ParagraphInformation(latestParagraphOrder, paragraphContent, expectedTimePerParagraph, realTimePerParagraph)); + expectedTimePerParagraph = LocalTime.of(0,0,0,0); + realTimePerParagraph = LocalTime.of(0,0,0,0); latestParagraphOrder = paragraphOrder; paragraphContent = sentence.getSentenceContent(); + expectedTimePerParagraph = sumLocalTime(expectedTimePerParagraph, sentence.getSentenceExpectTime()); + realTimePerParagraph = sumLocalTime(realTimePerParagraph, sentence.getSentenceRealTime()); } else if (paragraphOrder.equals(latestParagraphOrder)) { paragraphContent += sentence.getSentenceContent(); expectedTimePerParagraph = sumLocalTime(expectedTimePerParagraph, sentence.getSentenceExpectTime());