mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
minor (comments, etc) changes to PR
This commit is contained in:
parent
6e4d29b7b3
commit
df91fe154f
@ -143,7 +143,7 @@ public class RatingController : Controller
|
||||
rank.RatingAverage += (float)((decimal)r.Value / (decimal)rank.Ratings.Count);
|
||||
}
|
||||
|
||||
if (eID != -1 || uID != null) {
|
||||
if (eID != -1 || uID != null) { // do not sort "single item" (eID == -1 and no uID) category
|
||||
RatingRank[] ranks = ctx.RatingRanks
|
||||
.Where(rr => rr != rank && rr.CategoryID == category) // Only rank by category.
|
||||
.OrderBy(rr => rr.Rank)
|
||||
@ -160,9 +160,11 @@ public class RatingController : Controller
|
||||
}
|
||||
if (!resortOthers) rank.Rank = ranks.Length+1;
|
||||
}
|
||||
|
||||
rating.Date = DateTime.UtcNow;
|
||||
rank.UpdateDate = rating.Date;
|
||||
ctx.SaveChanges();
|
||||
|
||||
return new RatingInfo() {
|
||||
Id = rating.Id,
|
||||
OwnerUid = viking.Uid,
|
||||
|
@ -7,15 +7,11 @@ public class Rating {
|
||||
public int Id { get; set; }
|
||||
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public int RankId { get; set; }
|
||||
|
||||
public int Value { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
|
||||
public virtual Viking Viking { get; set; }
|
||||
|
||||
public virtual RatingRank Rank { get; set; }
|
||||
}
|
||||
|
@ -7,15 +7,11 @@ public class RatingRank {
|
||||
public int Id { get; set; }
|
||||
|
||||
public int CategoryID { get; set; }
|
||||
|
||||
public int? RatedEntityID { get; set; }
|
||||
public string? RatedUserID { get; set; }
|
||||
|
||||
public int Rank { get; set; }
|
||||
|
||||
/// <summary>On a scale of 1-5</summary>
|
||||
public float RatingAverage { get; set; }
|
||||
|
||||
public float RatingAverage { get; set; } // On a scale of 1-5
|
||||
public DateTime UpdateDate { get; set; }
|
||||
|
||||
public virtual ICollection<Rating> Ratings { get; set; } = null!;
|
||||
|
Loading…
x
Reference in New Issue
Block a user