Skip to content

Commit

Permalink
Merge pull request #414 from twenty-three-23/feature/TT-510
Browse files Browse the repository at this point in the history
TT-510
  • Loading branch information
ch8930 authored Nov 21, 2024
2 parents 5a0a95b + 0cdb2a6 commit 206c3a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -46,14 +47,14 @@ public List<KeyWordsByParagraph> getKeyWordsByScriptId(Long scriptId) {
public HistoryDetailResponseDTO getScriptDetail(Long scriptId) {
ParagraphsInformationDomain paragraphsInformationDomain = paragraphFetcher.fetchParagraphsInformation(scriptId);
List<ParagraphInformation> paragraphInformations = paragraphsInformationDomain.getParagraphInformations();
LocalTime totalRealTime = LocalTime.of(0, 0, 0);
LocalTime totalRealTime = LocalTime.of(0, 0, 0, 0);

List<HistoryParagraphDTO> 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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 206c3a7

Please sign in to comment.