Skip to content
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] 시험 문제 자동 채점기능 구현 #99

Merged
merged 13 commits into from
Nov 20, 2024

Conversation

hyerin315
Copy link
Contributor

관련 이슈

변경 사항

1. 시험 채점 서비스 구현

  • GradingService에 자동 채점 처리 메서드 processGrading 구현
    • 객관식/주관식 문제를 문자열 일치 여부로 채점
    • 각 문제별 점수 계산 및 총점 업데이트
  • GradingService에 verifyTotalScore에서 채점 결과 검증 메서드 구현
    • 개별 문제 점수 합계와 총점 일치 여부 확인
  • GradingService에 gradeExamResult에 API용 채점 메서드 구현
    • 채점 권한 검증 및 예외 처리
    • 채점 결과 로깅

3. 채점 통계 기능 구현

  • GradingService에 calculateAverageScore에 평균 점수 계산 메서드 구현
    • 시험별 평균 점수 산출
  • GradingService에 calculateScoreStatistics에 점수 통계 메서드 구현
    • 최고/최저 점수 계산
    • 정답률 통계 산출

4. 채점 관련 API 구현

  • GradingController에 채점 요청 및 통계 조회 엔드포인트 구현
  • 채점 관련 예외 처리기 구현
    • GradingException
    • GradingNotPossibleException
    • InvalidScoreException

5. AutoGradingScheduler 클래스로 자동 채점 스케줄러 구현

  • 미채점 시험 자동 채점 기능
  • 시험 시간 초과 시 자동 제출 처리
  • 채점 실패 시 예외 처리 및 로깅

스크린샷

기능 스크린샷
자동 채점 기능 스크린샷 2024-11-20 오후 4 58 35
평균 점수 조회 스크린샷 2024-11-20 오후 4 56 31
최고/최저 점수 조회 image

체크리스트

  • 코드 컨벤션을 준수하였습니까?
  • 모든 테스트를 통과하였습니까?
  • 관련 문서를 업데이트하였습니까?

공유 사항

채점 프로세스 흐름 참고 부탁드립니다.

  • 채점 프로세스 흐름
    • 시험 제출(SUBMITTED) → 자동 채점 → 채점 완료(GRADED)
    • 객관식/주관식 문제 모두 정확한 문자열 일치 시 정답 처리
    • 총점 자동 계산 및 통계 처리

추후 업무

  • 코드 효율성을 높이기 위한 리팩토링

- 답안을 자동 채점하고 검증하는 gradeExamResult 메소드 구현
- 총점 계산하는 verifyTotalScore 메소드 구현
- ExamQuestion의 정답 채점 메서드 추가
- MultipleChoiceQuestion에서 학생의 객관식 답안이 유효한 선택지 범위에 포함되는지 및 정답 여부를 검증
- SubjectiveQuestion에서 학생의 주관식 답안 비교 시 대소문자를 무시하고, 앞뒤 공백을 제거하도록 처리
- 채점 결과 로직 개선
 - ExamResult에 totalScore 필드 추가
 - 상태 관리 강화 (IN_PROGRESS -> SUBMITTED -> GRADED)
 - 통계 메서드 추가 (정답률 등)
 - 검증 로직 강화
 - 채점 결과 업데이트 로직 추가
- ExamScore에 불필요한 필드 제거 및 로직 개선
 - feedback 필드 제거
 - 임시 저장 상태 관리 개선
 - 점수 업데이트 로직 개선
 - 정답 여부 확인 메서드 추가
- 제출 여부 확인 및 각 문제별 답안 채점 기능 구현
- 총점 계산 및 시험 검토 상태 업데이트 기능 구현
- 평균 점수 계산 및 총점에서 최고/최저 점수 조회 기능 구현
- GradingController에 시험 결과 채점 요청, 평균 점수 조회 최고/최저 점수 통계 조회 엔드포인트 구현
- log import 오휴 해결
- ExamResultRepository에 조회 쿼리 추가
 - 특정 시험의 채점 상태를 확인할 수 있는 쿼리 추가
 - 시험 시간이 초과된 시험의 조회 쿼리 추가
 - 채점 대기 중인 시험 조회 쿼리 추가
- AutoGradingScheduler에 자동화 기능 구현
 - 시간 초과시 시험 자동 제출 기능 구현 (1분 간격 스케줄)
 - 제출된 시험 자동 채점 기능 구현 (5분 간격 스케줄)
- ErrorCode에 채첨 관련 에러 메세지 정의
- 채점 예외 처리 클래스 생성
 - GradingException
 - GradingNotPossibleException
 - InvalidScoreException
- ErrorCode 내 공백 수정
- AutoGradingScheduler에 불필요한 문자 삭제
- GradingService에 클래스명 및 주석 수정
- ErrorResponse 응답 객체 구현
- GradingException 등 채점 관련 예외 처리 핸들러 추가
- ExamQuestion 조회를 위한 쿼리 메소드 추가
- 점수 업데이트 시 사용되던 하드코딩된 리터럴 값 제거
- GradingService에 총점 계산 및 상태 업데이트 로직 추가
@hyerin315 hyerin315 added the enhancement New feature or request label Nov 20, 2024
@hyerin315 hyerin315 self-assigned this Nov 20, 2024
Copy link
Member

@Chan-GN Chan-GN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼼꼼하게 작업해주셨네요.
고생 많으셨습니다!

if (selectedNumber < 1 || selectedNumber > choices.size()) {
return false;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

특히 이 부분 코드가 읽기 좋고 잘 하셨네요!

Copy link
Contributor

@sseung519 sseung519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자동채점스케쥴러가 인상적이네요!
예외처리도 깔끔하게 잘해주셨습니다!
고생하셨습니다!

@hyerin315 hyerin315 merged commit 9302a4c into main Nov 20, 2024
1 check passed
@hyerin315 hyerin315 deleted the feature/93-auto-grading-system branch November 20, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEAT] 시험 문제 자동 채점 기능 구현
3 participants