Skip to content

Commit

Permalink
patch: added head coach data and other minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
plaberge committed Jul 26, 2024
1 parent de0a105 commit 09ea2c5
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 20 deletions.
17 changes: 1 addition & 16 deletions NHLStats/NHLStats/Division.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,7 @@ public Division(int theDivisionId)
}
}

public static List<Division> GetAllDivisions()
{
var json = DataAccessLayer.ExecuteAPICall(NHLAPIServiceURLs.divisions);
var divisionArray = JArray.Parse(json.SelectToken("divisions").ToString());

List<Division> listOfDivisions = new List<Division>();
Division tempDivision;

foreach (var aDivision in divisionArray)
{
tempDivision = new Division(Convert.ToInt32(aDivision.SelectToken("id")));
listOfDivisions.Add(tempDivision);
}

return listOfDivisions;
}


}
}
10 changes: 10 additions & 0 deletions NHLStats/NHLStats/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public class Game
public BoxScore boxScore { get; set; }
public List<GameEvent> gameEvents { get; set; }
public List<Person> officials { get; set; } // The list of officials for the game
public Person awayCoach { get; set; }
public Person homeCoach { get; set; }

public Schedule parentSchedule { get; set; }
public JToken json { get; set; }

Expand Down Expand Up @@ -146,6 +149,13 @@ public Game(JToken game, string gameDate, Schedule parent)
awayTeam = new Team(boxScoreJson.SelectToken("awayTeam"), this);
homeTeam = new Team(boxScoreJson.SelectToken("homeTeam"), this);


// Populate the coaches for the game
JObject awayCoachJson = boxScoreJson.SelectToken("summary.gameInfo.awayTeam.headCoach").ToObject<JObject>();
JObject homeCoachJson = boxScoreJson.SelectToken("summary.gameInfo.homeTeam.headCoach").ToObject<JObject>();
awayCoach = new Person(awayCoachJson, "coach");
homeCoach = new Person(homeCoachJson, "coach");

// Populate the list of officials for the game
officials = new List<Person>();
Person tempReferee;
Expand Down
2 changes: 1 addition & 1 deletion NHLStats/NHLStats/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Person(JObject json, string personType)
{
personId = " ";
fullName = json["default"].ToString();
role = "Coach";
role = "Head Coach";
personJson = json;
}
else
Expand Down
2 changes: 2 additions & 0 deletions NHLStats/NHLStats/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Schedule
{
public string nextStartDate { get; set; }
public string previousStartDate { get; set; }
public string scheduleDate { get; set; }
public List<Game> games { get; set; }
//public Oddspartner[] oddsPartners { get; set; }
public string preSeasonStartDate { get; set; }
Expand All @@ -24,6 +25,7 @@ public class Schedule
// Default constructor: shows today's schedule
public Schedule(string scheduleDate)
{
this.scheduleDate = scheduleDate;
string gameDateScheduleURL;
if (scheduleDate == null)
gameDateScheduleURL = NHLAPIServiceURLs.todaysGames + Utilities.GetYesterdaysDate();
Expand Down
Binary file modified NHLStats/NHLStats/bin/Debug/net6.0/NHLStats.dll
Binary file not shown.
Binary file modified NHLStats/NHLStats/bin/Debug/net6.0/NHLStats.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("NHLStats")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a63ee9e874ce10adfe11f4aed0da3658f5b7161c")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+de0a105499768c5503b4b1a13d5a23206712b5f9")]
[assembly: System.Reflection.AssemblyProductAttribute("NHLStats")]
[assembly: System.Reflection.AssemblyTitleAttribute("NHLStats")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f7184cfb7f2e4982a573b632f2ecf0199e2f58c8e7e0621ab6dc008fee2db603
07464e4564637db30fc58aaf74f6e0229748a23d4d91f694e90a7f4b1d2bc624
Binary file modified NHLStats/NHLStats/obj/Debug/net6.0/NHLStats.dll
Binary file not shown.
Binary file modified NHLStats/NHLStats/obj/Debug/net6.0/NHLStats.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"C:\\Users\\plaberge\\source\\repos\\plaberge\\nhlstats\\*":"https://raw.githubusercontent.com/plaberge/nhlstats/a63ee9e874ce10adfe11f4aed0da3658f5b7161c/*"}}
{"documents":{"C:\\Users\\plaberge\\source\\repos\\plaberge\\nhlstats\\*":"https://raw.githubusercontent.com/plaberge/nhlstats/de0a105499768c5503b4b1a13d5a23206712b5f9/*"}}
Binary file modified NHLStats/NHLStats/obj/Debug/net6.0/ref/NHLStats.dll
Binary file not shown.
Binary file modified NHLStats/NHLStats/obj/Debug/net6.0/refint/NHLStats.dll
Binary file not shown.

0 comments on commit 09ea2c5

Please sign in to comment.