Пример #1
0
        public void StoreWhenMissing(Summoner summoner)
        {
            var existing = _summoners.GetDocument(summoner.Id);
            if (existing != null)
                return;

            var result = _summoners.SaveDocument(new Document<Summoner>(summoner));
        }
Пример #2
0
        public void Store(Summoner summoner)
        {
            var existing = _summoners.GetDocument<Summoner>(summoner.Id);
            if (existing != null)
                existing = UpdateExisting(existing, summoner);

            var result = _summoners.SaveDocument(new Document<Summoner>(existing));
        }
Пример #3
0
        public async Task Crawl(Summoner summoner, Action<FellowPlayerInfo> foundSummoner, Action<PlayerGameStats> foundGame)
        {
            if (summoner == null)
                return;

            var recent = await _statsService.GetRecentGames((int) summoner.AccountId);
            var set = new HashSet<long>();

            foreach (var game in recent.gameStatistics)
            {
                foundGame(game);

                foreach (var participant in game.fellowPlayers)
                {
                    if (set.Contains(participant.summonerId)) continue;
                    
                    set.Add(participant.summonerId);
                    foundSummoner(participant);
                }
            }
        }
Пример #4
0
 private Summoner UpdateExisting(Summoner existing, Summoner summoner)
 {
     summoner.Rev = existing.Rev;
     //            existing.AccountId = summoner.AccountId;
     //            existing.InternalName = summoner.InternalName;
     //            existing.LastCrawledDate = summoner.LastCrawledDate;
     //            existing.LastGameDate = summoner.LastGameDate;
     //            existing.LeaverPenalties = summoner.LeaverPenalties;
     //            existing.Level = summoner.Level;
     //            existing.Name = summoner.Name;
     //            existing.PreviousFirstWinOfDay = summoner.PreviousFirstWinOfDay;
     //            existing.ProfileIconId = summoner.ProfileIconId;
     //            existing.PromotionGamesPlayed = summoner.PromotionGamesPlayed;
     //            existing.PromotionGamesPlayedUpdatedDate = summoner.PromotionGamesPlayedUpdatedDate;
     //            existing.RevisionDate = summoner.RevisionDate;
     //            existing.SeasonOneTier = summoner.SeasonOneTier;
     //            existing.SeasonTwoTier = summoner.SeasonTwoTier;
     //            existing.SeasonThreeTier = summoner.SeasonThreeTier;
     return summoner;
 }