Skip to content

Commit

Permalink
Restore mapped properties on game (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Jan 22, 2025
1 parent f238a52 commit 14d51db
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Gameboard.Api/Data/Entities/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,26 @@ public class Game : IEntity
public ICollection<Feedback> Feedback { get; set; } = [];
public ICollection<ChallengeGate> Prerequisites { get; set; } = [];

[NotMapped] public bool RequireSession => SessionMinutes > 0;
[NotMapped] public bool RequireTeam => MinTeamSize > 1;
[NotMapped] public bool AllowTeam => MaxTeamSize > 1;

[NotMapped]
public bool IsLive =>
GameStart != DateTimeOffset.MinValue &&
GameStart.CompareTo(DateTimeOffset.UtcNow) < 0 &&
GameEnd.CompareTo(DateTimeOffset.UtcNow) > 0;

[NotMapped]
public bool HasEnded =>
GameEnd.CompareTo(DateTimeOffset.UtcNow) < 0;

[NotMapped]
public bool RegistrationActive =>
RegistrationType != GameRegistrationType.None &&
RegistrationOpen.CompareTo(DateTimeOffset.UtcNow) < 0 &&
RegistrationClose.CompareTo(DateTimeOffset.UtcNow) > 0;

[NotMapped] public bool IsCompetitionMode => PlayerMode == PlayerMode.Competition;
[NotMapped] public bool IsPracticeMode => PlayerMode == PlayerMode.Practice;
}

0 comments on commit 14d51db

Please sign in to comment.