File tree Expand file tree Collapse file tree
packages/web/src/projector Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,15 +40,18 @@ async function loadNextLeague(currentLeagueId: number): Promise<League> {
4040 . sort ( ( a , b ) => a . rank - b . rank )
4141 ) ;
4242 const nextLeagueId =
43- users . length > ( currentLeagueId + 1 ) * USER_COUNT_IN_LEAGUE
43+ users . length > ( currentLeagueId + 1 ) * ( USER_COUNT_IN_LEAGUE - 1 ) + 1
4444 ? currentLeagueId + 1
4545 : 0 ;
4646
4747 // リーグに参加できない人のいないよう、下から数えて 4 人を参加させる
48- const startRank = Math . min (
49- nextLeagueId * USER_COUNT_IN_LEAGUE ,
50- users . length - USER_COUNT_IN_LEAGUE
51- ) ;
48+ const startRank =
49+ nextLeagueId !== 0
50+ ? Math . min (
51+ nextLeagueId * ( USER_COUNT_IN_LEAGUE - 1 ) ,
52+ users . length - USER_COUNT_IN_LEAGUE
53+ )
54+ : 0 ;
5255 // max(User#rank) = users.length - 1
5356 const leagueUsers = users . slice ( startRank , startRank + USER_COUNT_IN_LEAGUE ) ;
5457 if ( leagueUsers . length !== USER_COUNT_IN_LEAGUE )
You can’t perform that action at this time.
0 commit comments