Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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