mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 16:38:37 +00:00
Rename LastMatch to LastContact
This commit is contained in:
parent
6fb294a5b5
commit
eb4d0c6f67
6 changed files with 8 additions and 8 deletions
|
@ -74,17 +74,17 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
|
|
||||||
#region Update LastMatch
|
#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
|
// below makes it not look like trash
|
||||||
// ReSharper disable once ConvertIfStatementToNullCoalescingExpression
|
// ReSharper disable once ConvertIfStatementToNullCoalescingExpression
|
||||||
if (lastMatch == null)
|
if (lastMatch == null)
|
||||||
{
|
{
|
||||||
lastMatch = new LastMatch
|
lastMatch = new LastContact
|
||||||
{
|
{
|
||||||
UserId = user.UserId,
|
UserId = user.UserId,
|
||||||
};
|
};
|
||||||
this.database.LastMatches.Add(lastMatch);
|
this.database.LastContacts.Add(lastMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMatch.Timestamp = TimestampHelper.Timestamp;
|
lastMatch.Timestamp = TimestampHelper.Timestamp;
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace LBPUnion.ProjectLighthouse
|
||||||
public DbSet<Score> Scores { get; set; }
|
public DbSet<Score> Scores { get; set; }
|
||||||
public DbSet<PhotoSubject> PhotoSubjects { get; set; }
|
public DbSet<PhotoSubject> PhotoSubjects { get; set; }
|
||||||
public DbSet<Photo> Photos { get; set; }
|
public DbSet<Photo> Photos { get; set; }
|
||||||
public DbSet<LastMatch> LastMatches { get; set; }
|
public DbSet<LastContact> LastContacts { get; set; }
|
||||||
public DbSet<VisitedLevel> VisitedLevels { get; set; }
|
public DbSet<VisitedLevel> VisitedLevels { get; set; }
|
||||||
public DbSet<RatedLevel> RatedLevels { get; set; }
|
public DbSet<RatedLevel> RatedLevels { get; set; }
|
||||||
public DbSet<AuthenticationAttempt> AuthenticationAttempts { get; set; }
|
public DbSet<AuthenticationAttempt> AuthenticationAttempts { get; set; }
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
{
|
{
|
||||||
private static readonly Database database = new();
|
private static readonly Database database = new();
|
||||||
|
|
||||||
public static async Task<int> RecentMatches() => await database.LastMatches.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).CountAsync();
|
public static async Task<int> RecentMatches() => await database.LastContacts.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).CountAsync();
|
||||||
|
|
||||||
public static async Task<int> SlotCount() => await database.Slots.CountAsync();
|
public static async Task<int> SlotCount() => await database.Slots.CountAsync();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
|
|
||||||
this.PlayersOnlineCount = await StatisticsHelper.RecentMatches();
|
this.PlayersOnlineCount = await StatisticsHelper.RecentMatches();
|
||||||
|
|
||||||
List<int> userIds = await this.Database.LastMatches.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync();
|
List<int> 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();
|
this.PlayersOnline = await this.Database.Users.Where(u => userIds.Contains(u.UserId)).ToListAsync();
|
||||||
return this.Page();
|
return this.Page();
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Types.Profiles
|
namespace LBPUnion.ProjectLighthouse.Types.Profiles
|
||||||
{
|
{
|
||||||
public class LastMatch
|
public class LastContact
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
|
@ -109,7 +109,7 @@ namespace LBPUnion.ProjectLighthouse.Types
|
||||||
public string Status {
|
public string Status {
|
||||||
get {
|
get {
|
||||||
using Database database = new();
|
using Database database = new();
|
||||||
LastMatch? lastMatch = database.LastMatches.Where
|
LastContact? lastMatch = database.LastContacts.Where
|
||||||
(l => l.UserId == this.UserId)
|
(l => l.UserId == this.UserId)
|
||||||
.FirstOrDefault(l => TimestampHelper.Timestamp - l.Timestamp < 300);
|
.FirstOrDefault(l => TimestampHelper.Timestamp - l.Timestamp < 300);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue