Пример #1
0
        //public InfoByDate<ICollection<ConfigModelRankInfo>> GetLastRank() => RankSyntheticByDate.OrderBy(i => i.DateTime).LastOrDefault()
        //    ?? new InfoByDate<ICollection<ConfigModelRankInfo>>(default(DateTime),
        //        new ConfigModelRankInfo[] {
        //            new ConfigModelRankInfo(RankFormatEnum.Constructed),
        //            new ConfigModelRankInfo(RankFormatEnum.Limited)
        //        });

        //public InfoByDate<Inventory> GetLastInventory() => InventoryByDate.OrderBy(i => i.DateTime).LastOrDefault()
        //    ?? new InfoByDate<Inventory>(default(DateTime), new Inventory());

        //public InfoByDate<IList<PlayerQuest>> GetLastPlayerQuests() => PlayerQuestsByDate.OrderBy(i => i.DateTime).LastOrDefault()
        //    ?? new InfoByDate<IList<PlayerQuest>>(default(DateTime), new PlayerQuest[0]);

        //public InfoByDate<Dictionary<DateTime, CrackBoosterRaw>> GetLastCrackedBoosters() => CrackedBoostersByDate.OrderBy(i => i.DateTime).LastOrDefault()
        //    ?? new InfoByDate<Dictionary<DateTime, CrackBoosterRaw>>(default(DateTime), new Dictionary<DateTime, CrackBoosterRaw>());

        //public InfoByDate<IList<DraftMakePickRaw>> GetLastDraftPickProgress() => DraftPickProgressByDate.OrderBy(i => i.DateTime).LastOrDefault()
        //    ?? new InfoByDate<IList<DraftMakePickRaw>>(default(DateTime), new DraftMakePickRaw[0]);

        //public InfoByDate<Dictionary<DateTime, DraftMakePickRaw>> GetLastDraftPickProgressIntraday() => DraftPickProgressIntradayByDate.OrderBy(i => i.DateTime).LastOrDefault()
        //    ?? new InfoByDate<Dictionary<DateTime, DraftMakePickRaw>>(default(DateTime), new Dictionary<DateTime, DraftMakePickRaw>());

        public DateSnapshotInfo GetForDate(DateTime dateFor)
        {
            var resultForDate = new DateSnapshotInfo
            {
                Date           = dateFor,
                MtgaDecksFound = MtgaDecksFoundByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new HashSet <string>(),
                Collection     = CollectionByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <int, int>(),
                //Decks = DecksByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new ConfigModelRawDeck[0],
                Inventory              = InventoryByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Inventory(),
                Matches                = MatchesByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new List <MatchResult>(),
                PlayerQuests           = PlayerQuestsByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new List <PlayerQuest>(),
                CrackedBoosters        = CrackedBoostersByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, CrackBoosterRaw>(),
                RankSynthetic          = RankSyntheticByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new List <ConfigModelRankInfo>(),
                PlayerProgress         = PlayerProgressByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <string, PlayerProgress>(),
                PlayerProgressIntraday = PlayerProgressIntradayByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, GetPlayerProgressRaw>(),
                InventoryUpdates       = InventoryUpdatesByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, InventoryUpdatedRaw>(),
                PostMatchUpdates       = PostMatchUpdatesByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, PostMatchUpdateRaw>(),
                //DraftPickProgress = DraftPickProgressByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new List<DraftMakePickRaw>(),
                DraftPickProgressIntraday = DraftPickProgressIntradayByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, DraftMakePickRaw>(),
                VaultsOpened        = VaultsOpenedByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, CompleteVaultRaw>(),
                CollectionIntraday  = CollectionIntradayByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, Dictionary <int, int> >(),
                InventoryIntraday   = InventoryIntradayByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, Inventory>(),
                RankUpdated         = RankUpdatedByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, RankUpdatedRaw>(),
                CombinedRankInfo    = CombinedRankInfoByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, GetCombinedRankInfoRaw>(),
                EventClaimPrize     = EventClaimPriceByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, EventClaimPrizeRaw>(),
                MythicRatingUpdated = MythicRatingUpdatedByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, MythicRatingUpdatedRaw>(),
                PayEntry            = PayEntryByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new Dictionary <DateTime, PayEntryRaw>(),
            };

            //var diff = DiffByDate.SingleOrDefault(i => i.DateTime.Date == dateFor)?.Info ?? new DateSnapshotDiff();

            //return (resultForDate, diff);
            return(resultForDate);
        }