Skip to content

Commit

Permalink
Merge branch 'develop' into fix/cast-creation/80
Browse files Browse the repository at this point in the history
  • Loading branch information
ja7811 committed Aug 22, 2024
2 parents 9c2c2d2 + f3b841c commit 42e56b2
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ private List<BookmarkResultDTO> getBookMarkResultDTOs(Member member, List<Cast>

sentences.forEach(sentence -> {

Sentence nextSentence = sentenceRepository.findById(sentence.getId() + 1)
Sentence prevSentence = sentenceRepository.findById(sentence.getId() - 1)
.orElseGet(() -> Sentence.builder()
.timePoint(null)
.build());

if(!Objects.equals(nextSentence.getCast().getId(), sentence.getCast().getId())){
nextSentence = Sentence.builder()
if(!Objects.equals(prevSentence.getCast().getId(), sentence.getCast().getId())){
prevSentence = Sentence.builder()
.timePoint(null)
.build();
}
Expand All @@ -78,8 +78,8 @@ private List<BookmarkResultDTO> getBookMarkResultDTOs(Member member, List<Cast>
.sentenceId(sentence.getId())
.originalSentence(sentence.getOriginalSentence())
.translatedSentence(sentence.getTranslatedSentence())
.start(sentence.getTimePoint())
.end(nextSentence.getTimePoint())
.start(prevSentence.getTimePoint())
.end(sentence.getTimePoint())
.build());
}
);
Expand All @@ -96,13 +96,13 @@ public List<BookmarkResultDTO> getBookmarks(Member member, Long playlistId) {

return sentenceList.stream().map(sentence -> {

Sentence nextSentence = sentenceRepository.findById(sentence.getId() + 1)
Sentence prevSentence = sentenceRepository.findById(sentence.getId() - 1)
.orElseGet(() -> Sentence.builder()
.timePoint(null)
.build());

if(!Objects.equals(nextSentence.getCast().getId(), sentence.getCast().getId())){
nextSentence = Sentence.builder()
if(!Objects.equals(prevSentence.getCast().getId(), sentence.getCast().getId())){
prevSentence = Sentence.builder()
.timePoint(null)
.build();
}
Expand All @@ -113,8 +113,8 @@ public List<BookmarkResultDTO> getBookmarks(Member member, Long playlistId) {
.sentenceId(sentence.getId())
.originalSentence(sentence.getOriginalSentence())
.translatedSentence(sentence.getTranslatedSentence())
.start(sentence.getTimePoint())
.end(nextSentence.getTimePoint())
.start(prevSentence.getTimePoint())
.end(sentence.getTimePoint())
.build();
}).toList();
}
Expand Down

0 comments on commit 42e56b2

Please sign in to comment.