Skip to content

Commit

Permalink
feat: OCR 요청 시 리턴 형식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursin0330 committed Nov 29, 2024
1 parent cb19bd7 commit dfd7f4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.hangeulbada.domain.assignment.controller;

import com.hangeulbada.domain.annotation.StudentTag;
import com.hangeulbada.domain.assignment.dto.AssignmentSavedDto;
import com.hangeulbada.domain.assignment.dto.AssignmentSummaryDto;
import com.hangeulbada.domain.assignment.dto.ScoreDTO;
import com.hangeulbada.domain.assignment.dto.SpecificAssignmentDTO;
import com.hangeulbada.domain.assignment.service.AssignmentService;
import com.hangeulbada.domain.group.dto.GroupAssignmentDTO;
Expand All @@ -29,7 +29,7 @@ public class AssignmentController {
@PostMapping("/assignment/submit")
@Operation(summary="OCR 요청", description="OCR 요청 전송")
@ApiResponse(responseCode = "200", description = "OCR 후 문항별 점수 반환")
public ResponseEntity<List<ScoreDTO>> submit(
public ResponseEntity<AssignmentSavedDto> submit(
@RequestBody @Parameter(description = "OCR 요청 데이터", required = true, content = @Content(schema = @Schema(implementation = OCRRequest.class)))
OCRRequest ocrRequest,
Principal principal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SpecificCompareDTO {
String number;
String answer;
String studentAnswer;
boolean isCorrect;
public class AssignmentSavedDto {
String id;
List<ScoreDTO> scoreDtoList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SpecificAssignmentDTO getAssignment(String studentId, String workbookId)
}


public List<ScoreDTO> requestOCR(OCRRequest ocrRequest, String studentId){
public AssignmentSavedDto requestOCR(OCRRequest ocrRequest, String studentId){
String wId = ocrRequest.getWorkbookId();
List<String> questionIds = workbookService.getQuestionIdsByWorkbookId(wId);

Expand Down Expand Up @@ -92,12 +92,11 @@ public List<ScoreDTO> requestOCR(OCRRequest ocrRequest, String studentId){
for(AssignmentContent content: newAssignment.getAnswers()){
content.setQuestionFull(questions.get(idx++));
}
assignmentRepository.save(newAssignment);
Assignment savedAssignment = assignmentRepository.save(newAssignment);

//오답 태그 저장
saveIncorrectTag(assignmentDto, qIdMap, studentId);

return scoreDTOS;
return AssignmentSavedDto.builder().id(savedAssignment.getId()).scoreDtoList(scoreDTOS).build();
}


Expand Down

0 comments on commit dfd7f4c

Please sign in to comment.