File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -135,23 +135,21 @@ public override async Task Handle(HandlerContext<Command> context)
135135 }
136136
137137 // remove extraneous rosters
138- Roster [ ] toRemove = rosters . Where ( x => foundMatchIds . Contains ( x . BitsMatchId ) == false ) . ToArray ( ) ;
138+ Roster [ ] toRemove = rosters
139+ . Where ( x => foundMatchIds . Contains ( x . BitsMatchId ) == false
140+ && x . MatchResultId is null
141+ && x . Turn <= 20 )
142+ . ToArray ( ) ;
139143 if ( toRemove . Any ( ) )
140144 {
141- List < Roster > actualRemoved = new ( ) ;
142145 foreach ( Roster roster in toRemove )
143146 {
144- // only regular season games, playoff is handled differently
145- if ( roster . MatchResultId is null && roster . Turn <= 20 )
146- {
147- CompositionRoot . DocumentSession . Delete ( roster ) ;
148- actualRemoved . Add ( roster ) ;
149- }
147+ CompositionRoot . DocumentSession . Delete ( roster ) ;
150148 }
151149
152150 string joined = string . Join (
153151 "," ,
154- actualRemoved . Select ( x => $ "Id={ x . Id } BitsMatchId={ x . BitsMatchId } ") ) ;
152+ toRemove . Select ( x => $ "Id={ x . Id } BitsMatchId={ x . BitsMatchId } ") ) ;
155153 Logger . InfoFormat ( "Rosters to remove: {joined}" , joined ) ;
156154 string body = $ "Rosters to remove: { joined } ";
157155 SendEmail email = SendEmail . ToAdmin (
You can’t perform that action at this time.
0 commit comments