Skip to content

Commit

Permalink
Feat : answer list into each video in material 4 pdf api
Browse files Browse the repository at this point in the history
  • Loading branch information
D-w-nJ committed Nov 20, 2023
1 parent e5c48c2 commit 875d3d1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/main/java/com/m9d/sroom/material/MaterialService.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,15 @@ private void addMaterialAndQuizAnswer(CourseVideo courseVideo, List<Answer4PdfRe
if (courseVideo.getMaterialStatus().equals(MaterialStatus.CREATED)) {
summaryBrief = new SummaryBrief(summaryService.getSummaryEntity(courseVideo.getSummaryId()));

Answer4PdfResponse answer4PdfResponse = Answer4PdfResponse.getDefault(courseVideo.getVideoIndex(),
videoRepository.getById(courseVideo.getVideoId()).getTitle());
for (Quiz quiz : quizService.getQuizList(courseVideo.getVideoId())) {
quizList.add(new Quiz4PdfResponse(quiz, quizIndex));
answerList.add(new Answer4PdfResponse(courseVideo.getVideoIndex(), quizIndex, quiz.getAnswer(),
answer4PdfResponse.getVideoAnswers().add(new VideoAnswer4PdfResponse(quizIndex, quiz.getAnswer(),
quiz.getOptionStrList().get(Integer.parseInt(quiz.getAnswer()) - 1)));
quizIndex++;
}
answerList.add(answer4PdfResponse);
}

contentList.add(Content4PdfResponse.create(videoRepository.getById(courseVideo.getVideoId()), courseVideo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
public class Answer4PdfResponse {

private int videoIndex;
private int quizIndex;
private String answer;
private String answerStr;
private String videoTitle;

private List<VideoAnswer4PdfResponse> videoAnswers;

public static Answer4PdfResponse getDefault(int videoIndex, String title) {
return new Answer4PdfResponse(videoIndex, title, new ArrayList<>());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.m9d.sroom.material.dto.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@AllArgsConstructor
public class VideoAnswer4PdfResponse {

private int quizIndex;
private String answer;
private String answerStr;
}

0 comments on commit 875d3d1

Please sign in to comment.