diff --git a/ProjectLighthouse/Controllers/MatchController.cs b/ProjectLighthouse/Controllers/MatchController.cs index 4315628e..cd9400c1 100644 --- a/ProjectLighthouse/Controllers/MatchController.cs +++ b/ProjectLighthouse/Controllers/MatchController.cs @@ -74,17 +74,17 @@ namespace LBPUnion.ProjectLighthouse.Controllers #region Update LastMatch - LastMatch? lastMatch = await this.database.LastMatches.Where(l => l.UserId == user.UserId).FirstOrDefaultAsync(); + LastContact? lastMatch = await this.database.LastContacts.Where(l => l.UserId == user.UserId).FirstOrDefaultAsync(); // below makes it not look like trash // ReSharper disable once ConvertIfStatementToNullCoalescingExpression if (lastMatch == null) { - lastMatch = new LastMatch + lastMatch = new LastContact { UserId = user.UserId, }; - this.database.LastMatches.Add(lastMatch); + this.database.LastContacts.Add(lastMatch); } lastMatch.Timestamp = TimestampHelper.Timestamp; diff --git a/ProjectLighthouse/Database.cs b/ProjectLighthouse/Database.cs index b8a9a599..3a5366cc 100644 --- a/ProjectLighthouse/Database.cs +++ b/ProjectLighthouse/Database.cs @@ -27,7 +27,7 @@ namespace LBPUnion.ProjectLighthouse public DbSet Scores { get; set; } public DbSet PhotoSubjects { get; set; } public DbSet Photos { get; set; } - public DbSet LastMatches { get; set; } + public DbSet LastContacts { get; set; } public DbSet VisitedLevels { get; set; } public DbSet RatedLevels { get; set; } public DbSet AuthenticationAttempts { get; set; } diff --git a/ProjectLighthouse/Helpers/StatisticsHelper.cs b/ProjectLighthouse/Helpers/StatisticsHelper.cs index 53d51710..97091d22 100644 --- a/ProjectLighthouse/Helpers/StatisticsHelper.cs +++ b/ProjectLighthouse/Helpers/StatisticsHelper.cs @@ -8,7 +8,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers { private static readonly Database database = new(); - public static async Task RecentMatches() => await database.LastMatches.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).CountAsync(); + public static async Task RecentMatches() => await database.LastContacts.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).CountAsync(); public static async Task SlotCount() => await database.Slots.CountAsync(); diff --git a/ProjectLighthouse/Pages/LandingPage.cshtml.cs b/ProjectLighthouse/Pages/LandingPage.cshtml.cs index b02d3897..64fcd9dd 100644 --- a/ProjectLighthouse/Pages/LandingPage.cshtml.cs +++ b/ProjectLighthouse/Pages/LandingPage.cshtml.cs @@ -27,7 +27,7 @@ namespace LBPUnion.ProjectLighthouse.Pages this.PlayersOnlineCount = await StatisticsHelper.RecentMatches(); - List userIds = await this.Database.LastMatches.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync(); + List userIds = await this.Database.LastContacts.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync(); this.PlayersOnline = await this.Database.Users.Where(u => userIds.Contains(u.UserId)).ToListAsync(); return this.Page(); diff --git a/ProjectLighthouse/Types/Profiles/LastMatch.cs b/ProjectLighthouse/Types/Profiles/LastContact.cs similarity index 90% rename from ProjectLighthouse/Types/Profiles/LastMatch.cs rename to ProjectLighthouse/Types/Profiles/LastContact.cs index 832430cd..295250b8 100644 --- a/ProjectLighthouse/Types/Profiles/LastMatch.cs +++ b/ProjectLighthouse/Types/Profiles/LastContact.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; namespace LBPUnion.ProjectLighthouse.Types.Profiles { - public class LastMatch + public class LastContact { [Key] public int UserId { get; set; } diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 001997f4..6f24a385 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -109,7 +109,7 @@ namespace LBPUnion.ProjectLighthouse.Types public string Status { get { using Database database = new(); - LastMatch? lastMatch = database.LastMatches.Where + LastContact? lastMatch = database.LastContacts.Where (l => l.UserId == this.UserId) .FirstOrDefault(l => TimestampHelper.Timestamp - l.Timestamp < 300);