예제 #1
0
 public Publisher(Guid publisherID, LeagueYearKey leagueYearKey, FantasyCriticUser user, string publisherName, string?publisherIcon, int draftPosition,
                  IEnumerable <PublisherGame> publisherGames, IEnumerable <FormerPublisherGame> formerPublisherGames, uint budget, int freeGamesDropped, int willNotReleaseGamesDropped, int willReleaseGamesDropped,
                  bool autoDraft)
 {
     PublisherID                = publisherID;
     LeagueYearKey              = leagueYearKey;
     User                       = user;
     PublisherName              = publisherName;
     PublisherIcon              = publisherIcon;
     DraftPosition              = draftPosition;
     PublisherGames             = publisherGames.ToList();
     FormerPublisherGames       = formerPublisherGames.ToList();
     Budget                     = budget;
     FreeGamesDropped           = freeGamesDropped;
     WillNotReleaseGamesDropped = willNotReleaseGamesDropped;
     WillReleaseGamesDropped    = willReleaseGamesDropped;
     AutoDraft                  = autoDraft;
 }
예제 #2
0
        public async Task UpdateFantasyPoints(int year)
        {
            Dictionary <Guid, decimal?> publisherGameScores = new Dictionary <Guid, decimal?>();

            IReadOnlyList <LeagueYear> activeLeagueYears = await GetLeagueYears(year);

            Dictionary <LeagueYearKey, LeagueYear> leagueYearDictionary = activeLeagueYears.ToDictionary(x => x.Key, y => y);
            IReadOnlyList <Publisher> allPublishersForYear = await _fantasyCriticRepo.GetAllPublishersForYear(year);

            foreach (var publisher in allPublishersForYear)
            {
                var key = new LeagueYearKey(publisher.LeagueYear.League.LeagueID, publisher.LeagueYear.Year);
                foreach (var publisherGame in publisher.PublisherGames)
                {
                    var     leagueYear    = leagueYearDictionary[key];
                    decimal?fantasyPoints = publisherGame.CalculateFantasyPoints(leagueYear.Options.ScoringSystem, _clock);
                    publisherGameScores.Add(publisherGame.PublisherGameID, fantasyPoints);
                }
            }

            await _fantasyCriticRepo.UpdateFantasyPoints(publisherGameScores);
        }
예제 #3
0
 public Publisher ToDomain(LeagueYearKey leagueYearKey, FantasyCriticUser user, IEnumerable <PublisherGame> publisherGames, IEnumerable <FormerPublisherGame> formerPublisherGames)
 {
     return(new Publisher(PublisherID, leagueYearKey, user, PublisherName, PublisherIcon, DraftPosition,
                          publisherGames, formerPublisherGames, Budget, FreeGamesDropped, WillNotReleaseGamesDropped, WillReleaseGamesDropped, AutoDraft));
 }
예제 #4
0
 public string GetLeagueLink(LeagueYearKey key) => $"{BaseAddress}/league/{key.LeagueID}/{key.Year}";
예제 #5
0
 public static Publisher GetFakePublisher(LeagueYearKey leagueYearKey)
 {
     return(new Publisher(Guid.Empty, leagueYearKey, FantasyCriticUser.GetFakeUser(), "<Unknown Publisher>",
                          null, 0, new List <PublisherGame>(),
                          new List <FormerPublisherGame>(), 0, 0, 0, 0, false));
 }