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

✨ [Feature] 토너먼트 게임 매칭 로직 추가 #404

Merged
merged 47 commits into from
Dec 18, 2023

Conversation

Kimhan-nah
Copy link
Member

@Kimhan-nah Kimhan-nah commented Dec 17, 2023

📌 개요

  • 토너먼트 게임 매칭 로직 및 매칭된 게임의 플레이어 수정 로직 추가
  • 8강 매칭 시점은 스케줄러로 매칭되고, 4강과 결승전은 이전 라운드의 모든 경기가 점수 입력이 완료되었을 때 매칭합니다.
  • 관리자 토너먼트 수정 API, 토너먼트 게임 결과 등록 API, 토너먼트 매칭 스케줄러에서 사용되는 로직입니다.

💻 작업사항

MatchTournamentService 토너먼트 매칭 서비스의 메서드

  • checkTournamentGame() : 토너먼트 게임 매칭이 필요한지 확인하는 함수
    • TournamentMatchStatus enum 값을 반환합니다. (아래에 설명)
  • matchGames() : 토너먼트 게임 매칭 함수
  • updateMatchedGameUser() : 이미 매칭된 게임의 팀 유저를 수정하는 함수

TournamentMatchStatus Enum Class

  • 토너먼트 매칭 상태에 대한 enum class입니다.
  • IMPOSSIBLE : 매칭 불가능
  • POSSIBLE : 매칭 가능
  • ALREADY_MATCHED : 이미 다음 경기가 매칭된 상태 (매칭 불가능)

토너먼트 게임 시간에 대하여

  • 현재는 토너먼트 시작 시간에 의존적입니다.
  • 이후에 토너먼트 시작 시간이 SlotManagementinterval을 고려하여 계산하도록 수정 예정입니다.
    • ex) interval이 15분이고 시작시간이 14:08일 경우, 첫 경기가 14:15가 되도록 수정 예정
  • 슬롯 블락에 대해서는 startTime, endTime 모두 interval을 고려하여 앞뒤로 넉넉하게 block 시켜줍니다.
    • ex) interval이 15분이고 시작시간이 14:08일 경우, 14:00까지 슬롯 블락
    • ex) interval이 15분이고 종료시간이 17:08일 경우, 17:15까지 슬롯 블락

기타 수정사항

  • TeamIdNotMatchException에서 ErrorCode의 .getMessage()를 사용하도록 수정
  • TournamentGameNotFoundException에서 잘못 사용중이었던 ErrorCode 수정
  • 기존 test/domain/match/service/MatchTestUtils.java -> test/utils/MatchTestUtils.java로 이동
  • 토너먼트 게임이 같은 라운드인지(8강/4강/결승) 확인이 필요하여 TournamentRoundint roundNum 필드가 추가되었습니다.

마지막으로..

  • QA 기간동안만 토너먼트 매칭 스케줄러 주기를 10분으로 짧게 가지려고 합니다. 해당 내용도 포함되어 있습니다.
  • 현재 단위 테스트를 작성하지 못했습니다.. 단위테스트까지 완료하고 올릴까 고민했는데 빨리 리뷰 받는 게 먼저인 것 같아서 올립니다.
  • 생각보다 많은 수정이 있습니다.. 리뷰하기 힘들겠지만 잘 부탁드립니다...ㅎㅎ

💡Issue 번호

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (d8ded43) 68.88% compared to head (54a34b6) 69.35%.

Files Patch % Lines
...min/tournament/service/TournamentAdminService.java 45.45% 5 Missing and 1 partial ⚠️
...com/gg/server/domain/game/service/GameService.java 0.00% 4 Missing and 1 partial ⚠️
...om/gg/server/domain/match/utils/SlotGenerator.java 0.00% 4 Missing ⚠️
...r/domain/match/service/MatchTournamentService.java 96.10% 1 Missing and 2 partials ⚠️
...r/domain/team/exception/TeamNotFoundException.java 0.00% 2 Missing ⚠️
...ent/exception/TournamentGameNotFoundException.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #404      +/-   ##
============================================
+ Coverage     68.88%   69.35%   +0.46%     
- Complexity      786      812      +26     
============================================
  Files           250      254       +4     
  Lines          3648     3720      +72     
  Branches        339      341       +2     
============================================
+ Hits           2513     2580      +67     
- Misses          946      947       +1     
- Partials        189      193       +4     
Flag Coverage Δ
integrationTest 69.03% <83.84%> (+0.47%) ⬆️
unitTest 9.67% <7.69%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Kimhan-nah Kimhan-nah self-assigned this Dec 17, 2023
@Kimhan-nah Kimhan-nah added enhancement New feature or request refactoring labels Dec 17, 2023
@Kimhan-nah Kimhan-nah changed the title 367 match tournament ✨ [Feature] 토너먼트 게임 매칭 로직 추가 Dec 17, 2023
Copy link
Contributor

@SONGS4RI SONGS4RI left a comment

Choose a reason for hiding this comment

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

확인 부탁드려요!

middlefitting
middlefitting previously approved these changes Dec 17, 2023
Copy link
Member

@middlefitting middlefitting left a comment

Choose a reason for hiding this comment

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

확인했습니다.

@SONGS4RI SONGS4RI self-requested a review December 18, 2023 04:10
SONGS4RI
SONGS4RI previously approved these changes Dec 18, 2023
Copy link
Contributor

@SONGS4RI SONGS4RI left a comment

Choose a reason for hiding this comment

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

수고많으셨습니다!

kokomong2
kokomong2 previously approved these changes Dec 18, 2023
Copy link
Member

@kokomong2 kokomong2 left a comment

Choose a reason for hiding this comment

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

확인했습니다~ 수고하셨습니다!

match util 함수와 update score 함수 호출 순서 수정
Copy link
Contributor

@Newsujin Newsujin left a comment

Choose a reason for hiding this comment

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

상당히 많은 로직을 추가해주시느라 고생 많으셨습니다!! 감사합니다 :-)

@Kimhan-nah Kimhan-nah merged commit 78e59aa into dev Dec 18, 2023
1 check passed
@Kimhan-nah Kimhan-nah deleted the 367-match-tournament branch December 18, 2023 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ [Feature] 토너먼트 다음 round의 게임 매칭 로직 추가
6 participants