Commit 1f12f79 1 parent 8e5cc97 commit 1f12f79 Copy full SHA for 1f12f79
File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -43,17 +43,22 @@ const sortConnections = (data: I.SpyRoom[]) => {
43
43
[ [ ] , [ ] ] as I . SpyRoom [ ] [ ] ,
44
44
) ;
45
45
46
- // 再按创建时间排序
47
- const sortFn = ( a : I . SpyRoom , b : I . SpyRoom ) => {
48
- if ( a . createdAt > b . createdAt ) {
49
- return 1 ;
46
+ // 有效房间再按创建时间升序
47
+ const ascWithCreatedAtForInvalid = valid . sort ( ( a , b ) => {
48
+ if ( a . createdAt < b . createdAt ) {
49
+ return - 1 ;
50
50
}
51
- return - 1 ;
52
- } ;
53
- const createdAtWithAscForValid = valid . sort ( sortFn ) ;
54
- const createdAtWithAscForInvalid = invalid . sort ( sortFn ) ;
51
+ return 1 ;
52
+ } ) ;
53
+ // 失效房间再按活动时间升序
54
+ const ascWithActiveAtForInvalid = invalid . sort ( ( a , b ) => {
55
+ if ( a . activeAt < b . activeAt ) {
56
+ return - 1 ;
57
+ }
58
+ return 1 ;
59
+ } ) ;
55
60
56
- return [ ...createdAtWithAscForValid , ...createdAtWithAscForInvalid ] ;
61
+ return [ ...ascWithCreatedAtForInvalid , ...ascWithActiveAtForInvalid ] ;
57
62
} ;
58
63
59
64
const filterConnections = (
You can’t perform that action at this time.
0 commit comments