Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤨 Motivation
🔑 Key Changes
매칭 신청자가 1회차에 매칭을 신청했고, 다음 참가자들을 모집하기 위해 시스템은 매칭 회차를 업데이트 합니다.
그 후, 사용자가 내 파트너를 조회합니다.
이 때, 시스템은 업데이트 된 매칭 회차로 매칭 파트너를 조회합니다. (currentMatchingRound = 2, memberId = 1)
(당연히 쿼리 결과가 없습니다. 😓)
그래서, 조회 결과 리스트가 (isEmpty() == true && member.hasPartner() == true) 인 경우
직전 매칭 회차로 파트너를 조회합니다. (previousMatchingRound = 1, memberId = 1)
이렇게, 매칭 회차가 업데이트 된 경우에도 나의 매칭 결과를 조회 할 수 있도록 구현했습니다.
🙏 To Reviewers
'왜 (isEmpty() == true && member.hasPartner() == true) 인 경우를 확인하고 가져오는거냐?'
'바로 currentMatchingRound - 1 을 해서 previousMatchingRound를 구한다음 조회하면 되는거 아니냐?'
고 생각 하실 수 있습니다.
그렇게 구현하게 되면 실제 환경에서 매칭 결과를 바로 확인해볼 수 없게됩니다.
다음 매칭 회차가 +1 될때까지 기다려야 결과를 볼 수 있는 것이죠....
테스트 시, 결과를 바로 API로 조회해볼 수 있다는 장점이 있습니다!
나중엔 그냥 해당 api 요청할때 파라미터로 매칭 회차를 직접 넣어서 하는 방식이 더 나을수도 있겠네요...
하지만 이 api가 현재 매칭회차의 파트너 조회이므로,
이런식으로 구체적인 정보를 주지 않고도 결과를 주려다 보니 위 방식으로 구현하게 되었습니다.
오류를 찾아주신 @mjj111 명준님 감사합니다 😊
앞으론 다양한 예외 케이스에 대해서 생각을 깊게 하도록 하겠습니다 🥲