Skip to content

Commit

Permalink
feat: 학생의 클래스 조회 시 오답 제외
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursin0330 committed Nov 29, 2024
1 parent 75dfa4b commit 6cef6cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void leaveGroup(@PathVariable(name="groupId") String groupId, Principal p
}
@StudentTag
@GetMapping("/student/group")
@Operation(summary = "학생의 클래스 조회", description = "학생이 참여한 클래스를 조회합니다.")
@Operation(summary = "학생의 일반 클래스 조회", description = "학생이 참여한 클래스중 오답클래스를 제외하고 조회합니다.")
@ApiResponse(responseCode = "200", description = "클래스 조회 성공")
public ResponseEntity<List<GroupAttendResponse>> getAttendGroup(Principal principal){
List<GroupAttendResponse> group = groupService.getAttendGroup(principal.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface GroupRepository extends MongoRepository<Group, String> {

Optional<Group> findByGroupCode(String code);

List<Group> findByStudentIdsContaining(String studentId);
List<Group> findByStudentIdsContainingAndGroupCodeIsNotNull(String studentId);

@Aggregation(pipeline = {
"{ $match: { teacherId: ?0, groupCode: null } }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void leaveGroup(String groupId, String studentId){
}

public List<GroupAttendResponse> getAttendGroup(String studentId){
List<Group> groups = groupRepository.findByStudentIdsContaining(studentId);
List<Group> groups = groupRepository.findByStudentIdsContainingAndGroupCodeIsNotNull(studentId);
return groups.stream()
.map(group -> mapper.map(group, GroupAttendResponse.class))
.collect(Collectors.toList());
Expand Down

0 comments on commit 6cef6cc

Please sign in to comment.