-
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.
BE: [fix] 시험 등록 시 On/Off 기능 추가 및 CheatingStatistic 수정
BE: [fix] 시험 등록 시 On/Off 기능 추가 및 CheatingStatistic 수정
- Loading branch information
Showing
15 changed files
with
267 additions
and
45 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
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
22 changes: 22 additions & 0 deletions
22
src/backend/Eyesee/src/main/java/com/fortune/eyesee/dto/CheatingStatistic.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,22 @@ | ||
package com.fortune.eyesee.dto; | ||
|
||
import lombok.Data; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Data | ||
public class CheatingStatistic { | ||
private Integer cheatingStatisticsId; | ||
private String koreanTypeName; | ||
private Integer cheatingCount; | ||
private String detectedTime; | ||
|
||
// 생성자 | ||
public CheatingStatistic(Integer cheatingStatisticsId, String koreanTypeName, Integer cheatingCount, String detectedTime) { | ||
this.cheatingStatisticsId = cheatingStatisticsId; | ||
this.koreanTypeName = koreanTypeName; | ||
this.cheatingCount = cheatingCount; | ||
this.detectedTime = detectedTime; | ||
} | ||
|
||
} |
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
9 changes: 8 additions & 1 deletion
9
src/backend/Eyesee/src/main/java/com/fortune/eyesee/dto/TokenWithUserIdResponseDTO.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,14 +1,21 @@ | ||
package com.fortune.eyesee.dto; | ||
|
||
|
||
public class TokenWithUserIdResponseDTO extends TokenResponseDTO { | ||
private Integer userId; | ||
private Integer examId; | ||
|
||
public TokenWithUserIdResponseDTO(String accessToken, String refreshToken, Integer userId) { | ||
public TokenWithUserIdResponseDTO(String accessToken, String refreshToken, Integer userId, Integer examId) { | ||
super(accessToken, refreshToken); | ||
this.userId = userId; | ||
this.examId = examId; | ||
} | ||
|
||
public Integer getUserId() { | ||
return userId; | ||
} | ||
|
||
public Integer getExamId() { | ||
return examId; | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
src/backend/Eyesee/src/main/java/com/fortune/eyesee/enums/CheatingTypeEnum.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,37 @@ | ||
package com.fortune.eyesee.enums; | ||
|
||
public enum CheatingTypeEnum { | ||
LOOK_AROUND("look_around", "주변 응시"), | ||
REPEATED_GAZE("repeated_gaze", "반복된 응시"), | ||
OBJECT("object", "부정행위 물체 감지"), | ||
FACE_ABSENCE_LONG("face_absence_long", "장기 화면 이탈"), | ||
FACE_ABSENCE_REPEAT("face_absence_repeat", "반복 화면 이탈"), | ||
HAND_GESTURE("hand_gesture", "특정 손동작 반복"), | ||
HEAD_TURN_LONG("head_turn_long", "고개 돌림 유지"), | ||
HEAD_TURN_REPEAT("head_turn_repeat", "고개 돌림 반복"); | ||
|
||
private final String englishName; | ||
private final String koreanName; | ||
|
||
CheatingTypeEnum(String englishName, String koreanName) { | ||
this.englishName = englishName; | ||
this.koreanName = koreanName; | ||
} | ||
|
||
public String getEnglishName() { | ||
return englishName; | ||
} | ||
|
||
public String getKoreanName() { | ||
return koreanName; | ||
} | ||
|
||
public static String getKoreanNameByEnglish(String englishName) { | ||
for (CheatingTypeEnum type : values()) { | ||
if (type.getEnglishName().equalsIgnoreCase(englishName)) { // 대소문자 무시 비교 | ||
return type.getKoreanName(); | ||
} | ||
} | ||
return "알 수 없음"; | ||
} | ||
} |
26 changes: 25 additions & 1 deletion
26
...kend/Eyesee/src/main/java/com/fortune/eyesee/repository/CheatingStatisticsRepository.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,16 +1,40 @@ | ||
package com.fortune.eyesee.repository; | ||
|
||
|
||
import com.fortune.eyesee.dto.CheatingStatistic; | ||
import com.fortune.eyesee.dto.UserDetailResponseDTO; | ||
import com.fortune.eyesee.entity.CheatingStatistics; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface CheatingStatisticsRepository extends JpaRepository<CheatingStatistics, Integer> { | ||
List<CheatingStatistics> findByUserId(Integer userId); | ||
int countByUserId(Integer userId); | ||
|
||
//int countByUserId(Integer userId); | ||
// 특정 userId와 cheatingTypeId에 대한 통계 정보를 조회 | ||
CheatingStatistics findByUserIdAndCheatingTypeId(Integer userId, Integer cheatingTypeId); | ||
|
||
@Query(""" | ||
SELECT new com.fortune.eyesee.dto.CheatingStatistic( | ||
cs.cheatingStatisticsId, | ||
ct.koreanTypeName, | ||
cs.cheatingCount, | ||
CAST(dc.detectedTime AS string) | ||
) | ||
FROM CheatingStatistics cs | ||
JOIN CheatingType ct ON cs.cheatingTypeId = ct.cheatingTypeId | ||
LEFT JOIN DetectedCheating dc ON cs.userId = dc.userId AND cs.cheatingTypeId = dc.cheatingTypeId | ||
WHERE cs.userId = :userId | ||
ORDER BY CAST(dc.detectedTime AS string) ASC | ||
""") | ||
List<CheatingStatistic> findStatisticsByUserId(@Param("userId") Integer userId); | ||
|
||
// 특정 사용자 ID의 부정행위 횟수를 합산 | ||
@Query("SELECT SUM(cs.cheatingCount) FROM CheatingStatistics cs WHERE cs.userId = :userId") | ||
Integer findTotalCheatingCountByUserId(@Param("userId") Integer userId); | ||
} |
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
Oops, something went wrong.