File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
import { Observable , scan } from "rxjs" ;
17
17
import { map } from "rxjs/operators" ;
18
18
import { ReqLoggingInterceptor } from "../../middleware/req-logging.interceptor" ;
19
+ import { getLobbyTypePriority } from "../../utils/getLobbyTypePriority" ;
19
20
20
21
function wrapSse < A > ( ) {
21
22
return ( source : A ) : MessageObjectDto < A > => ( {
@@ -31,7 +32,13 @@ export class LiveMatchController {
31
32
32
33
@Get ( "/list" )
33
34
async listMatches ( ) : Promise < LiveMatchDto [ ] > {
34
- return this . ls . list ( ) ;
35
+ return this . ls
36
+ . list ( )
37
+ . sort (
38
+ ( a , b ) =>
39
+ getLobbyTypePriority ( a . matchmakingMode ) -
40
+ getLobbyTypePriority ( b . matchmakingMode ) ,
41
+ ) ;
35
42
}
36
43
37
44
@ApiParam ( {
Original file line number Diff line number Diff line change
1
+ import { MatchmakingMode } from "../gateway/shared-types/matchmaking-mode" ;
2
+
3
+ export const getLobbyTypePriority = ( type : MatchmakingMode ) : number => {
4
+ let score = Number ( type ) ;
5
+
6
+ if ( type === MatchmakingMode . UNRANKED ) {
7
+ score -= 1000 ;
8
+ } else if ( type === MatchmakingMode . BOTS_2X2 ) {
9
+ score -= 100 ;
10
+ }
11
+ return score ;
12
+ } ;
You can’t perform that action at this time.
0 commit comments