-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: readExamResults 구현 #245
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ import com.swm_standard.phote.dto.GradeExamResponse | |
import com.swm_standard.phote.dto.ReadExamHistoryDetail | ||
import com.swm_standard.phote.dto.ReadExamHistoryDetailResponse | ||
import com.swm_standard.phote.dto.ReadExamHistoryListResponse | ||
import com.swm_standard.phote.dto.ReadExamStudentResult | ||
import com.swm_standard.phote.dto.ReadExamResultsResponse | ||
import com.swm_standard.phote.dto.SubmittedAnswerRequest | ||
import com.swm_standard.phote.entity.Answer | ||
import com.swm_standard.phote.entity.Category | ||
|
@@ -54,6 +56,7 @@ class ExamService( | |
@Value("\${openai.api.url}") | ||
lateinit var url: String | ||
|
||
@Transactional(readOnly = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 클래스에 어노테이션 붙어있어서 기존대로 빼도 될 것 같아온 |
||
fun readExamHistoryDetail(id: UUID): ReadExamHistoryDetailResponse { | ||
val examResult = examResultRepository.findByExamId(id) ?: throw NotFoundException(fieldName = "examResult") | ||
val responses = | ||
|
@@ -87,6 +90,7 @@ class ExamService( | |
) | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
fun readExamHistoryList(workbookId: UUID): List<ReadExamHistoryListResponse> { | ||
val exams = examRepository.findAllByWorkbookId(workbookId) | ||
return exams.map { exam -> | ||
|
@@ -104,6 +108,22 @@ class ExamService( | |
} | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
fun readExamResults(examId: UUID): ReadExamResultsResponse { | ||
val exam = examRepository.findById(examId).orElseThrow { NotFoundException(fieldName = "examId") } | ||
val examResults = examResultRepository.findAllByExamId(examId) | ||
|
||
val responses = examResults.map { examResult -> | ||
ReadExamStudentResult( | ||
examResult.member.id, | ||
examResult.member.name, | ||
examResult.totalCorrect | ||
) | ||
} | ||
|
||
return ReadExamResultsResponse(examId, exam.workbook.quantity, responses) | ||
} | ||
|
||
@Transactional | ||
fun gradeExam( | ||
workbookId: UUID, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 time (소요 시간) 들어가면 좋을 것 같네욘