Show used slots

This commit is contained in:
jvyden 2021-10-29 16:21:23 -04:00
commit edaf82c257
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using LBPUnion.ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types.Profiles; using LBPUnion.ProjectLighthouse.Types.Profiles;
using LBPUnion.ProjectLighthouse.Types.Settings; using LBPUnion.ProjectLighthouse.Types.Settings;
@ -50,7 +51,13 @@ namespace LBPUnion.ProjectLighthouse.Types {
/// <summary> /// <summary>
/// The number of used slots on the earth /// The number of used slots on the earth
/// </summary> /// </summary>
public int UsedSlots { get; set; } [NotMapped]
public int UsedSlots {
get {
using Database database = new();
return database.Slots.Count(s => s.CreatorId == this.UserId);
}
}
/// <summary> /// <summary>
/// The number of slots remaining on the earth /// The number of slots remaining on the earth