public virtual void UpdatePlayerRating(Ladder ladder, LadderStanding standing, User user, double rating, double vol, double rd, bool hasWon)
        {
            if (standing == null)
            {
                // Player has competed in this league for the first time
                Log.Info().Message("Adding ladder standing for {0} {1}", ladder.Id, user.Id).Write();
                standing = new LadderStanding(ladder, user);
                this.unitOfWork.GetGenericRepository <LadderStanding>().Add(standing);
            }

            standing.Rating = rating;
            standing.Vol    = vol;
            standing.Rd     = rd;

            standing.GamesPlayed++;
            if (hasWon)
            {
                standing.GamesWon++;
            }
            else
            {
                standing.GamesLost++;
            }

            standing.LastGame = DateTime.UtcNow;
        }
Beispiel #2
0
 public int GetStandingPosition(LadderStanding standing)
 {
     throw new NotImplementedException();
 }
 public int GetStandingPosition(LadderStanding standing)
 {
     return(this.Context.Set <LadderStanding>()
            .OrderByDescending(x => x.Rating)
            .Count(x => x.LadderId == standing.LadderId && x.Rating >= standing.Rating));
 }