Skip to content

Conversation

@injae-348
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@BlackBean99 BlackBean99 left a comment

Choose a reason for hiding this comment

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

실력이 많이 늘었습니다. 하지만 지금 코드는 너무 딱딱해보입니다. 더 유연해보일 수 있게 코드를 작성해보세요. 기획과 딱 맞는 코드는 좋지 못합니다.

Comment on lines +18 to +86
@RestController
@AllArgsConstructor
public class Test {
RegistrationService registrationService;

@PostMapping("/register")
public String register(@RequestBody Registration registration){
// 예외처리 필요할듯하다.
registrationService.register(registration);
return "success";
}

// 지원자 정보 생성
@PostMapping("/register-personal-inform")
public String registerPersonInform(@RequestBody PersonalInformation personalInformation){
registrationService.registerPersonalInform(personalInformation);
return "success";
}

// 지원자 지원 경로 생성
@PostMapping("/register-path")
public String registerPath(@RequestBody Path path){
registrationService.registerPath(path);
return "success";
}

// 지원자 면접 가능 시간 생성
@PostMapping("/register-desired-time")
public String registerDesiredTime(@RequestBody DesiredTime desiredTime){
registrationService.registerDesiredTime(desiredTime);
return "success";
}


// 전체 지원자 수
@GetMapping("/registrations-count")
public Integer getTotalRegisterCount(){
return registrationService.getRegistrationCount();
}

// 개발자, 기획자, 디자이너 별 지원자 수
@GetMapping("/registrations-hope-count")
public ArrayList<Integer> getHopeFieldsTotalRegisterCount(){
return registrationService.getHopeFieldsTotalCount();
}

// 희망 분야별 지원자 수
@GetMapping("/registrations/first-hope-field")
public Map<String, Integer> getFirstHopeFieldCount() {
return registrationService.getHopeFieldsFirstPriorityCount();
}
@GetMapping("/registrations/second-hope-field")
public Map<String, Integer> getSecondHopeFieldCount() {
return registrationService.getHopeFieldsSecondPriorityCount();
}

// 지원자 학과별 수
@GetMapping("/registrations/department-count")
public Map<String, Integer> getDepartmentCount(){
return registrationService.getDepartmentCount();
}

// 지원 경로별 수
@GetMapping("/registrations/path-count")
public Map<String, Integer> getPathCount(){
return registrationService.getPathCount();
}

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

인재님 앱 형태로 1개의 url로 합쳐보는 걸 과제로 드렸습니다. 이렇게 웹 요청으로 하게 되면 transmit delay가 엄청 발생할거에요.
최대한 요청 수를 줄일 수 있게 데이터를 구성해봅시다.

Comment on lines +77 to +95
for(Map.Entry<String,Registration> entrySet : registration.entrySet()){
if(entrySet.getValue().getHopeField().equals("개발자")){ // == 의 경우 비교 연산이 이뤄지지 않음
count = hopeFields.get(0);
hopeFields.set(0,count+1);
}
else if(entrySet.getValue().getHopeField().equals("기획자")){
count = hopeFields.get(1);
hopeFields.set(1,count+1);
}
else if(entrySet.getValue().getHopeField().equals("디자이너")){
count = hopeFields.get(2);
hopeFields.set(2,count+1);
}
else{
// 예외 처리
}
}
return hopeFields;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

조회를 index로 저렇게 숫자를 집어넣으시면 진짜 코드가 산으로갈겁니다. 가독성이 0거든요. 제가 분기처리하는 방법 많이 알려드렸으니 더 고민해보세요.

Comment on lines +4 to +9
POSTER("홍보 포스터"),
ANNOUNCEMENT("학과 공지사항"),
INTRODUCTION("지인 소개"),
INSTAGRAM("인스타그램"),
EVERYTIME("에브리타임"),
ETIC("기타");
Copy link
Collaborator

Choose a reason for hiding this comment

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

지원경로는 string으로 받으면 될텐데 굳이 이넘까지 쓴 이유가 있을까요?
실제로 개발을 해보시면 프론트들이 셀렉트 박스로 인풋값을 제한해주기 때문에 이런건 오히려 확장에 불리합니다.

Comment on lines +78 to +81
for(Path path : database.getAllPath().values()){
String p = path.getSupportPath().getType();
pathCount.put(p,pathCount.getOrDefault(p,0)+1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

집계를 for을 쓰는 순간부터 가독성은 현저히 떨어집니다. 이 코드는 해당 지원 경로를 순회하며 찾아서 1씩 추가해주는 것인데 그럽 map에 접근하는 횟수가 얼마나 될까요. map에 get하는 행위 없이 바로 집어넣어봅시다. stream을 쓰는 것도 방법일거구요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants