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

[FE] fix : 필수가 아닌 객관식, 서술형에서 답변 작성이 들어갈 경우에도 유효성 검사를 진행 #339

Merged
merged 9 commits into from
Aug 13, 2024

Conversation

BadaHertz52
Copy link
Contributor


🚀 어떤 기능을 구현했나요 ?

  1. 필수가 아닌 객관식, 서술형에서 리뷰어가 답변을 작성하는 지 여부 판단해요.
  2. 1에서 리뷰어가 작성한 답에 대한 유효성 검사 진행해요.
    : 빈문자열이나 빈 배열로 수정하면 유효성 검사 통과해요.
  3. 답변의 필수 여부, 답변의 유효성 여부를 판단해 다음,제출 버튼 활성화 여부를 판단해요.

코드로 설명

  • 답변의 유효성에 대한 상태 : answerValidationMap
  • 답변 유효성 상태를 관리하는 함수 : updateAnswerValidationMap
  • answerValidationMap을 업데이트할떼, useMultiple, useTextAnswer에서 필수가 아닌 답변이면서 서술형의 경우 빈문자열, 객관식의 경우 빈배열일때 유효성을 true로 설정합니다.
  • useReviewAnswer에서 isValidateAnswerList (= 답변들의 유효성 검사를 진행해 다음/제출 버튼을 활성화하는 함수)에서 answerValidation을 사용합니다.

🔥 어떻게 해결했나요 ?

  • 기존의 answerMap에서 아이디어를 얻어 questionId를 key 가지고 유효성 여부를 담는 value를 사용하도록 했어요.

📝 어떤 부분에 집중해서 리뷰해야 할까요?

  • 코드보다는 실제로 질문을 작성하면서, 필수가 아닌 질문에 값을 추가하면서 버튼의 활성화 여부를 확인하는 것을 추천해요.

📚 참고 자료, 할 말

  • 계속 나오는 버그, 세스코 불러!!

- answerValidationMap, updateAnswerValidationMap 생성
- answerValidationMap을 업데이트할떼, useMultiple, useTextAnswer에서 필수가 아닌 답변이면서 서술형의 경우 빈문자열, 객관식의 경우 빈배열일때 유효성을 true로 설정
- useReviewAnswer에서 isValidateAnswerList에서 answerValidation을 사용
@BadaHertz52 BadaHertz52 force-pushed the fe/fix/338-review_wirting_not_required branch from fe2d222 to 7cf782a Compare August 13, 2024 02:56
Copy link
Contributor

@ImxYJL ImxYJL left a comment

Choose a reason for hiding this comment

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

버그 멈춰!!!!! 폼 쉽지 않네요...

Copy link
Contributor

@chysis chysis left a comment

Choose a reason for hiding this comment

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

고생했어요!

Copy link
Contributor

@soosoo22 soosoo22 left a comment

Choose a reason for hiding this comment

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

수고했어요!

@BadaHertz52 BadaHertz52 merged commit 6fa82d3 into develop Aug 13, 2024
4 checks passed
@donghoony donghoony deleted the fe/fix/338-review_wirting_not_required branch August 20, 2024 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
4 participants