-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
117 additions
and
5 deletions.
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
40 changes: 40 additions & 0 deletions
40
...va/Chaeda_spring/domain/review_note/problem/dto/IncorrectProblemForReviewNoteRequest.java
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package Chaeda_spring.domain.review_note.problem.dto; | ||
|
||
import Chaeda_spring.domain.Problem.math.MathProblem; | ||
import Chaeda_spring.domain.submission.assignment.entity.WrongProblemRecord; | ||
import Chaeda_spring.global.constant.Chapter; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Builder | ||
public record IncorrectProblemForReviewNoteRequest( | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
@Schema(description = "문제를 틀린 날짜", example = "2024-05-22") | ||
LocalDate incorrectDate, | ||
@Schema(description = "교재 이름", example = "쎈 미적분") | ||
String textbookName, | ||
|
||
@Schema(description = "문제 번호", example = "101") | ||
String problemNum, | ||
|
||
@Schema(description = "문제가 속한 챕터") | ||
List<Chapter> chapters | ||
) { | ||
public static IncorrectProblemForReviewNoteRequest from(WrongProblemRecord record) { | ||
MathProblem mathProblem = record.getMathProblem(); | ||
List<Chapter> chapters = mathProblem.getProblemTypeMappings().stream() | ||
.map(type -> type.getMathProblemType().getChapter()) | ||
.collect(Collectors.toList()); | ||
return IncorrectProblemForReviewNoteRequest.builder() | ||
.incorrectDate(record.getIncorrectDate()) | ||
.textbookName(mathProblem.getTextbook().getName()) | ||
.problemNum(mathProblem.getProblemNumber()) | ||
.chapters(chapters) | ||
.build(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...main/java/Chaeda_spring/domain/review_note/problem/dto/IncorrectProblemRecordRequest.java
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package Chaeda_spring.domain.review_note.problem.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import java.time.LocalDate; | ||
|
||
public record IncorrectProblemRecordRequest( | ||
@Schema(description = "시작 날짜", example = "2024-04-01") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") | ||
LocalDate startDate, | ||
@Schema(description = "끝 날짜", example = "2024-04-30") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") | ||
LocalDate endDate | ||
) { | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
...ain/java/Chaeda_spring/domain/review_note/problem/dto/IncorrectProblemRecordResponse.java
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package Chaeda_spring.domain.review_note.problem.dto; | ||
|
||
import Chaeda_spring.global.constant.DifficultyLevel; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import java.time.LocalDate; | ||
|
||
public record IncorrectProblemRecordResponse( | ||
@Schema(description = "틀린 문제 ID", example = "1") | ||
Long id, | ||
@Schema(description = "틀린 날짜", example = "2024-04-15") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") | ||
LocalDate incorrectDate, | ||
@Schema(description = "난이도", example = "HARD") | ||
DifficultyLevel difficulty, | ||
@Schema(description = "문제 반호", example = "1") | ||
String problemNumber | ||
) { | ||
} |
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
7 changes: 7 additions & 0 deletions
7
.../java/Chaeda_spring/domain/submission/assignment/entity/WrongProblemRecordRepository.java
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
package Chaeda_spring.domain.submission.assignment.entity; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public interface WrongProblemRecordRepository extends JpaRepository<WrongProblemRecord, Long> { | ||
|
||
@Query("SELECT s FROM WrongProblemRecord s WHERE s.incorrectDate BETWEEN :startDate AND :endDate AND s.student = :student") | ||
List<WrongProblemRecord> findAllByWrongDateBetween(LocalDate startDate, LocalDate endDate); | ||
} |
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