Skip to content

Commit

Permalink
Top50: require activity last week (was month)
Browse files Browse the repository at this point in the history
Preventing inactive people from hogging the ladder promotes competition and activity.
  • Loading branch information
sprunk committed Sep 7, 2015
1 parent 7179aab commit 45ae78e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Zero-K.info/Controllers/LaddersController.cs
Expand Up @@ -136,12 +136,12 @@ private LadderModel GetLadder()
awardItems.Add(awardItem);
}

var lastMonth = DateTime.UtcNow.AddMonths(-1);
var lastWeek = DateTime.UtcNow.AddDays(-7);
var top50Accounts =
db.Accounts.Where(x => x.SpringBattlePlayers.Any(y => y.SpringBattle.StartTime > lastMonth)).Include(x=>x.Clan).Include(x=>x.Faction).OrderByDescending(x => x.Effective1v1Elo).WithTranslations().Take(50).ToList();
db.Accounts.Where(x => x.SpringBattlePlayers.Any(y => y.SpringBattle.StartTime > lastWeek)).Include(x=>x.Clan).Include(x=>x.Faction).OrderByDescending(x => x.Effective1v1Elo).WithTranslations().Take(50).ToList();

var top50Teams =
db.Accounts.Where(x => x.SpringBattlePlayers.Any(y => y.SpringBattle.StartTime > lastMonth)).Include(x => x.Clan).Include(x => x.Faction).OrderByDescending(x => x.EffectiveElo).WithTranslations().Take(50).ToList();
db.Accounts.Where(x => x.SpringBattlePlayers.Any(y => y.SpringBattle.StartTime > lastWeek)).Include(x => x.Clan).Include(x => x.Faction).OrderByDescending(x => x.EffectiveElo).WithTranslations().Take(50).ToList();

LadderModel ladder = new LadderModel { AwardItems = awardItems, Top50Accounts = top50Accounts, Top50Teams = top50Teams };
HttpContext.Cache.Add("ladderModel", ladder, null, DateTime.Now.AddHours(2), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
Expand Down Expand Up @@ -185,4 +185,4 @@ public class LadderModel
public List<Account> Top50Teams;
}
}
}
}

0 comments on commit 45ae78e

Please sign in to comment.