Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More minor fixes and reduce compile time warnings #42

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/FourthDown.Api/FourthDown.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<ItemGroup>
<PackageReference Include="Jaeger" Version="1.0.3" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
Expand Down
1 change: 1 addition & 0 deletions src/FourthDown.Shared/FourthDown.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="NodaTime" Version="3.0.10" />
<PackageReference Include="OpenTracing" Version="0.12.1" />
Expand Down
93 changes: 55 additions & 38 deletions src/FourthDown.Shared/Models/GameDetail.cs
Original file line number Diff line number Diff line change
@@ -1,90 +1,105 @@
#nullable enable
using System.Collections.Generic;
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace FourthDown.Shared.Models
{
internal class GameRaw
{
public DataObject Data { get; set; }

Check warning on line 10 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Data' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

[UsedImplicitly]
internal class DataObject
{
public Viewer Viewer { get; set; }

Check warning on line 16 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Viewer' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

[UsedImplicitly]
internal class Viewer
{
public GameDetail GameDetail { get; set; }

Check warning on line 22 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'GameDetail' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

[UsedImplicitly]
public class HomePointsOvertime
{
}

[UsedImplicitly]
public class GameTeam
{
public IReadOnlyList<string> Abbreviation { get; set; }

Check warning on line 33 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Abbreviation' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public IReadOnlyList<string> NickName { get; set; }

Check warning on line 34 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'NickName' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

[UsedImplicitly]
public class Period
{
}

[UsedImplicitly]
public class ScoringSummary
{
public int PlayId { get; set; }
public string PlayDescription { get; set; }
public string? PlayDescription { get; set; }
public int PatPlayId { get; set; }
public int HomeScore { get; set; }
public int VisitorScore { get; set; }
}

[UsedImplicitly]
public class VisitorPointsOvertime
{
}

[UsedImplicitly]
public class CurrentFahrenheit
{
}

[UsedImplicitly]
public class Location
{
}

[UsedImplicitly]
public class LongDescription
{
}

[UsedImplicitly]
public class CurrentRealFeelFahrenheit
{
}

[UsedImplicitly]
public class Weather
{
public CurrentFahrenheit CurrentFahrenheit { get; set; }

Check warning on line 80 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'CurrentFahrenheit' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public Location Location { get; set; }

Check warning on line 81 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Location' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public LongDescription LongDescription { get; set; }

Check warning on line 82 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'LongDescription' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public IList<string> ShortDescription { get; set; }

Check warning on line 83 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'ShortDescription' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public CurrentRealFeelFahrenheit CurrentRealFeelFahrenheit { get; set; }

Check warning on line 84 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'CurrentRealFeelFahrenheit' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

[UsedImplicitly]
public class YardLine
{
}

public class Drive
{
public int QuarterStart { get; set; }
public string EndTransition { get; set; }
public string EndYardLine { get; set; }
public string? EndTransition { get; set; }
public string? EndYardLine { get; set; }
public bool EndedWithScore { get; set; }
public int FirstDowns { get; set; }
public string GameClockEnd { get; set; }
public string GameClockStart { get; set; }
public string HowEndedDescription { get; set; }
public string HowStartedDescription { get; set; }
public string? GameClockEnd { get; set; }
public string? GameClockStart { get; set; }
public string? HowEndedDescription { get; set; }
public string? HowStartedDescription { get; set; }
public bool Inside20 { get; set; }
public double OrderSequence { get; set; }
public int PlayCount { get; set; }
Expand All @@ -93,81 +108,83 @@
public int PlaySeqEnded { get; set; }
public int PlaySeqStarted { get; set; }
public int QuarterEnd { get; set; }
public string StartTransition { get; set; }
public string StartYardLine { get; set; }
public string TimeOfPossession { get; set; }
public string? StartTransition { get; set; }
public string? StartYardLine { get; set; }
public string? TimeOfPossession { get; set; }
public int Yards { get; set; }
public int YardsPenalized { get; set; }
public string PossessionTeamAbbreviation { get; set; }
public string PossessionTeamNickName { get; set; }
public string PossessionTeamFranchiseCurrentLogoUrl { get; set; }
public string? PossessionTeamAbbreviation { get; set; }
public string? PossessionTeamNickName { get; set; }
public string? PossessionTeamFranchiseCurrentLogoUrl { get; set; }
}

[UsedImplicitly]
public class PlayStat
{
public int StatId { get; set; }
public int Yards { get; set; }
public string PlayerName { get; set; }
public string TeamId { get; set; }
public string TeamAbbreviation { get; set; }
public string GsisPlayerId { get; set; }
public string? PlayerName { get; set; }
public string? TeamId { get; set; }
public string? TeamAbbreviation { get; set; }
public string? GsisPlayerId { get; set; }
}

[UsedImplicitly]
public class Play
{
public string ClockTime { get; set; }
public string? ClockTime { get; set; }
public int Down { get; set; }
public string EndClockTime { get; set; }
public string EndYardLine { get; set; }
public string? EndClockTime { get; set; }
public string? EndYardLine { get; set; }
public bool FirstDown { get; set; }
public bool GoalToGo { get; set; }
public bool NextPlayIsGoalToGo { get; set; }
public string NextPlayType { get; set; }
public string? NextPlayType { get; set; }
public double OrderSequence { get; set; }
public bool PenaltyOnPlay { get; set; }
public int PlayClock { get; set; }
[JsonIgnore] public int PlayClock { get; set; }
public bool PlayDeleted { get; set; }
public string PlayDescription { get; set; }
public string PlayDescriptionWithJerseyNumbers { get; set; }
public string? PlayDescription { get; set; }
public string? PlayDescriptionWithJerseyNumbers { get; set; }
public int PlayId { get; set; }
public string PlayType { get; set; }
public string? PlayType { get; set; }
public IList<PlayStat> PlayStats { get; set; }
public string PrePlayByPlay { get; set; }
public string? PrePlayByPlay { get; set; }
public int Quarter { get; set; }
public bool ScoringPlay { get; set; }
public string ShortDescription { get; set; }
public string? ShortDescription { get; set; }
public bool SpecialTeamsPlay { get; set; }
public string TimeOfDay { get; set; }
public string YardLine { get; set; }
public string? TimeOfDay { get; set; }
public string? YardLine { get; set; }
public int Yards { get; set; }
public int YardsToGo { get; set; }
public int? DriveNetYards { get; set; }
public int? DrivePlayCount { get; set; }
public int? DriveSequenceNumber { get; set; }
public string DriveTimeOfPossession { get; set; }
public string PossessionTeamAbbreviation { get; set; }
public string PossessionTeamNickName { get; set; }
public string PossessionTeamFranchiseCurrentLogoUrl { get; set; }
public string? DriveTimeOfPossession { get; set; }
public string? PossessionTeamAbbreviation { get; set; }
public string? PossessionTeamNickName { get; set; }
public string? PossessionTeamFranchiseCurrentLogoUrl { get; set; }
public bool? IsBigPlay { get; set; }
public string ScoringPlayType { get; set; }
public string ScoringTeamId { get; set; }
public string ScoringTeamAbbreviation { get; set; }
public string ScoringTeamNickName { get; set; }
public string StPlayType { get; set; }
public string? ScoringPlayType { get; set; }
public string? ScoringTeamId { get; set; }
public string? ScoringTeamAbbreviation { get; set; }
public string? ScoringTeamNickName { get; set; }
public string? StPlayType { get; set; }
}

public class GameDetail
{
[JsonIgnore] public IList<string> Id { get; set; }

Check warning on line 178 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<string> Attendance { get; set; }

Check warning on line 179 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Attendance' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<int> Distance { get; set; }

Check warning on line 180 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Distance' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<int> Down { get; set; }

Check warning on line 181 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Down' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<string> GameClock { get; set; }

Check warning on line 182 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'GameClock' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<bool> GoalToGo { get; set; }

Check warning on line 183 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'GoalToGo' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public HomePointsOvertime HomePointsOvertime { get; set; }

Check warning on line 184 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'HomePointsOvertime' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public Period Period { get; set; }

Check warning on line 185 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Period' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<string> Phase { get; set; }

Check warning on line 186 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Phase' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public IList<bool> PlayReview { get; set; }

Check warning on line 187 in src/FourthDown.Shared/Models/GameDetail.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'PlayReview' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonIgnore] public GameTeam PossessionTeam { get; set; }
[JsonIgnore] public IList<bool> Redzone { get; set; }
[JsonIgnore] public IList<string> Stadium { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,22 @@ public async Task<GameDetail> GetGamePlaysAsync(Game game, CancellationToken can
{
using var scope = _tracer.BuildTrace(nameof(GetGamePlaysAsync));

scope.LogStart(nameof(GetGamePlaysAsync));

var url = GetGameUrl(game.GameId, game.Season);

scope.LogEnd(nameof(GetGamePlaysAsync));

if (_gamesCache.TryGetValue(game, out var gameDetail))
{
_logger.LogInformation($"Game found in cache: {game.GameId}");
return gameDetail;
}

scope.LogStart(nameof(GetGamePlaysAsync));

var url = GetGameUrl(game.GameId, game.Season);
gameDetail = await GetGameJson(url, cancellationToken, scope);
gameDetail.Game = game;

_gamesCache[game] = gameDetail;

scope.LogEnd(nameof(GetGamePlaysAsync));

return gameDetail;
}

Expand Down
Loading