1
- using Nhl . Api . Common . Exceptions ;
2
- using Nhl . Api . Common . Extensions ;
1
+ using Nhl . Api . Common . Extensions ;
3
2
using Nhl . Api . Common . Helpers ;
4
3
using Nhl . Api . Common . Http ;
5
4
using Nhl . Api . Enumerations . Game ;
@@ -167,7 +166,7 @@ public async Task<int> GetTotalPlayerStatisticValueByTypeAndSeasonAsync(PlayerEn
167
166
var player = await _nhlPlayerApi . GetPlayerInformationAsync ( playerEnum , cancellationToken ) ;
168
167
if ( player . Position == "G" )
169
168
{
170
- throw new InvalidPlayerPositionException ( $ "The player id { playerEnum } provided is a goaltender and is not a valid player" ) ;
169
+ return 0 ;
171
170
}
172
171
173
172
// Get team season schedule
@@ -233,7 +232,7 @@ public async Task<int> GetTotalPlayerStatisticValueByTypeAndSeasonAsync(int play
233
232
var player = await _nhlPlayerApi . GetPlayerInformationAsync ( playerId , cancellationToken ) ;
234
233
if ( player . Position == "G" )
235
234
{
236
- throw new InvalidPlayerPositionException ( $ "The player id { playerId } provided is a goaltender and is not a valid player" ) ;
235
+ return 0 ;
237
236
}
238
237
239
238
// Get team season schedule
@@ -318,7 +317,7 @@ public async Task<int> GetTotalPlayerStatisticValueByTypeAndSeasonAsync(int play
318
317
{
319
318
return ( player , statisticTotals ) ;
320
319
}
321
-
320
+
322
321
var teamAbbreviation = _nhlTeamService . GetTeamCodeIdentifierByTeamName ( teamName ) ;
323
322
324
323
// Get team season schedule
@@ -405,7 +404,7 @@ public async Task<int> GetTotalPlayerStatisticValueByTypeAndSeasonAsync(int play
405
404
406
405
// Get Player Team By Season
407
406
var teamName = player . SeasonTotals . FirstOrDefault ( x => x . Season == int . Parse ( seasonYear ) && x . LeagueAbbrev . Equals ( HockeyLeague . NationalHockeyLeague , StringComparison . InvariantCultureIgnoreCase ) ) ? . TeamName ? . Default ;
408
-
407
+
409
408
// If no team exists for the season, return the player and the statistic totals as empty
410
409
if ( string . IsNullOrWhiteSpace ( teamName ) )
411
410
{
@@ -416,9 +415,9 @@ public async Task<int> GetTotalPlayerStatisticValueByTypeAndSeasonAsync(int play
416
415
417
416
// Get team season schedule
418
417
var schedule = await _nhlLeagueApi . GetTeamScheduleBySeasonAsync ( teamAbbreviation , seasonYear , cancellationToken ) ;
419
- if ( gameType . HasValue )
420
- {
421
- schedule . Games = schedule . Games . Where ( x => x . GameType == ( int ) gameType ) . ToList ( ) ;
418
+ if ( gameType . HasValue )
419
+ {
420
+ schedule . Games = schedule . Games . Where ( x => x . GameType == ( int ) gameType ) . ToList ( ) ;
422
421
}
423
422
424
423
// Create tasks to retrieve game information
0 commit comments