Skip to content

Commit

Permalink
removed old files for clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Afischbacher committed Dec 31, 2023
1 parent b975575 commit 01baae6
Show file tree
Hide file tree
Showing 66 changed files with 28 additions and 62,325 deletions.
41 changes: 2 additions & 39 deletions Nhl.Api.Domain/Enumerations/Player/PlayerEnumHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,8 @@ public static class PlayerEnumHelper
/// <returns>A dictionary of players names and their identifiers for every NHL player to ever play</returns>
public static Dictionary<int, string> GetAllPlayers()
{
var nhlStatsApiHttpClient = new Api.Common.Http.NhlStatsApiHttpClient();
var players = new ConcurrentBag<Models.Player.Player>();

var internalPlayerEnumValues = typeof(InternalPlayerEnum)
.GetEnumValues()
.Cast<object>();

var internalPlayerEnumValuesDictionary = internalPlayerEnumValues.ToDictionary(key => (int)key, value => value.ToString());
var lastEnumValue = (int)internalPlayerEnumValues.OrderBy(c => c).Last();


Parallel.For(lastEnumValue, 8490000, new ParallelOptions { CancellationToken = default, MaxDegreeOfParallelism = 2 }, (i) =>
{
try
{
var player = NhlApiAsyncHelper.RunSync<LeaguePlayers>(() => nhlStatsApiHttpClient.GetAsync<LeaguePlayers>($"/people/{i}"))
.Players
.SingleOrDefault();

players.Add(player);
}
finally
{
}
});

var allPlayers = players.Where(p => p != null).DistinctBy(p => p.Id).ToList();
foreach (var newPlayer in allPlayers)
{
try
{
internalPlayerEnumValuesDictionary.Add(newPlayer.Id, $"{Regex.Replace(newPlayer.FullName, @"('|\.|\s|-|_|&|)", "")}{newPlayer.Id}");
}
catch
{
}
}

return internalPlayerEnumValuesDictionary;
//@TODO: Need to implement this using the NHL API
return new Dictionary<int, string>();

Check warning on line 25 in Nhl.Api.Domain/Enumerations/Player/PlayerEnumHelper.cs

View check run for this annotation

Codecov / codecov/patch

Nhl.Api.Domain/Enumerations/Player/PlayerEnumHelper.cs#L25

Added line #L25 was not covered by tests
}
}
}
Loading

0 comments on commit 01baae6

Please sign in to comment.