1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

change table design for rating history

This commit is contained in:
RaidMax
2018-05-31 19:17:52 -05:00
parent dca4d10967
commit 76d15e488e
10 changed files with 283 additions and 401 deletions

View File

@ -1,22 +0,0 @@
using SharedLibraryCore.Database.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace IW4MAdmin.Plugins.Stats.Models
{
public class EFClientAverageStatHistory : SharedEntity
{
[Key]
public int ClientId { get; set; }
[ForeignKey("ClientId")]
public virtual EFClient Client { get; set; }
public virtual ICollection<EFRating> Ratings { get; set; }
[Required]
public int LastRatingId { get; set; }
[ForeignKey("LastRatingId")]
public virtual EFRating LastRating { get; set; }
}
}

View File

@ -8,16 +8,13 @@ using System.Text;
namespace IW4MAdmin.Plugins.Stats.Models
{
public class EFClientStatHistory : SharedEntity
public class EFClientRatingHistory : SharedEntity
{
[Key]
public int StatHistoryId { get; set; }
public int RatingHistoryId { get; set; }
public int ClientId { get; set; }
[ForeignKey("ClientId")]
public virtual EFClient Client { get; set; }
public int ServerId { get; set; }
[ForeignKey("ServerId")]
public virtual EFServer Server { get; set; }
public virtual ICollection<EFRating> Ratings { get; set; }
}
}

View File

@ -11,12 +11,19 @@ namespace IW4MAdmin.Plugins.Stats.Models
{
[Key]
public int RatingId { get; set; }
public int ClientId { get; set; }
[ForeignKey("ClientId")]
public EFClient Client { get; set; }
public int RatingHistoryId { get; set; }
[ForeignKey("RatingHistoryId")]
public virtual EFClientRatingHistory RatingHistory { get; set; }
// if null, indicates that the rating is an average rating
public int? ServerId { get; set; }
// [ForeignKey("ServerId")] can't make this nullable if this annotation is set
public virtual EFServer Server { get; set; }
[Required]
public double Performance { get; set; }
[Required]
public int Ranking { get; set; }
[Required]
// indicates if the rating is the latest
public bool Newest { get; set; }
}
}