From 14d51dbd2de87ef0ddf1b2c1eebae97a7e6edd56 Mon Sep 17 00:00:00 2001 From: Ben Stein Date: Wed, 22 Jan 2025 09:46:49 -0500 Subject: [PATCH] Restore mapped properties on game (for now) --- src/Gameboard.Api/Data/Entities/Game.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Gameboard.Api/Data/Entities/Game.cs b/src/Gameboard.Api/Data/Entities/Game.cs index 2e5cd0ea..5733182d 100644 --- a/src/Gameboard.Api/Data/Entities/Game.cs +++ b/src/Gameboard.Api/Data/Entities/Game.cs @@ -78,13 +78,26 @@ public class Game : IEntity public ICollection Feedback { get; set; } = []; public ICollection 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; }