public PossibleRoyaleMasterGameViewModel(MasterGameYear masterGame, IClock clock, RoyaleYearQuarter yearQuarter, bool alreadyOwned, IEnumerable <MasterGameTag> masterGameTags)
 {
     MasterGame           = new MasterGameYearViewModel(masterGame, clock);
     WillReleaseInQuarter = masterGame.WillReleaseInQuarter(yearQuarter.YearQuarter);
     IsEligible           = !LeagueTagExtensions.GetRoyaleEligibilitySettings(masterGameTags).GameIsEligible(masterGame.MasterGame).Any();
     AlreadyOwned         = alreadyOwned;
     Cost = masterGame.GetRoyaleGameCost();
 }
Exemple #2
0
 public PossibleRoyaleMasterGameViewModel(MasterGameYear masterGame, IClock clock, RoyaleYearQuarter yearQuarter, bool alreadyOwned)
 {
     MasterGame           = new MasterGameYearViewModel(masterGame, clock);
     WillReleaseInQuarter = masterGame.WillReleaseInQuarter(yearQuarter.YearQuarter);
     IsEligible           = !EligibilitySettings.GetRoyaleEligibilitySettings().GameIsEligible(masterGame.MasterGame).Any();
     AlreadyOwned         = alreadyOwned;
     Cost = masterGame.GetRoyaleGameCost();
 }
Exemple #3
0
 public PossibleRoyaleMasterGameViewModel(MasterGameYear masterGame, LocalDate currentDate, RoyaleYearQuarter yearQuarter, bool alreadyOwned, IEnumerable <MasterGameTag> masterGameTags)
 {
     MasterGame           = new MasterGameYearViewModel(masterGame, currentDate);
     WillReleaseInQuarter = masterGame.WillReleaseInQuarter(yearQuarter.YearQuarter);
     AlreadyOwned         = alreadyOwned;
     IsEligible           = !LeagueTagExtensions.GetRoyaleClaimErrors(masterGameTags, masterGame.MasterGame, currentDate).Any();
     IsReleased           = masterGame.MasterGame.IsReleased(currentDate);
     HasScore             = masterGame.MasterGame.CriticScore.HasValue;
     Cost = masterGame.GetRoyaleGameCost();
 }
Exemple #4
0
    public SingleGameNewsViewModel(MasterGameYear masterGame, IReadOnlyList <LeagueYearPublisherPair> publishersPairsThatHaveGame, bool userMode, LocalDate currentDate)
    {
        MasterGame           = new MasterGameYearViewModel(masterGame, currentDate);
        MasterGameID         = masterGame.MasterGame.MasterGameID;
        GameName             = masterGame.MasterGame.GameName;
        EstimatedReleaseDate = masterGame.MasterGame.EstimatedReleaseDate;
        MaximumReleaseDate   = masterGame.MasterGame.GetDefiniteMaximumReleaseDate();
        ReleaseDate          = masterGame.MasterGame.ReleaseDate;

        if (userMode)
        {
            if (publishersPairsThatHaveGame.Count() == 1)
            {
                var publisherPair = publishersPairsThatHaveGame.Single();
                LeagueID      = publisherPair.LeagueYear.League.LeagueID;
                Year          = publisherPair.LeagueYear.Year;
                LeagueName    = publisherPair.LeagueYear.League.LeagueName;
                PublisherID   = publisherPair.Publisher.PublisherID;
                PublisherName = publisherPair.Publisher.PublisherName;
            }
            else
            {
                LeagueName    = $"{publishersPairsThatHaveGame.Count()} Leagues";
                PublisherName = "Multiple";
            }
        }
        else
        {
            if (publishersPairsThatHaveGame.Count() == 1)
            {
                var publisherPair = publishersPairsThatHaveGame.Single();
                LeagueID      = publisherPair.LeagueYear.League.LeagueID;
                Year          = publisherPair.LeagueYear.Year;
                LeagueName    = publisherPair.LeagueYear.League.LeagueName;
                PublisherID   = publisherPair.Publisher.PublisherID;
                PublisherName = publisherPair.Publisher.PublisherName;
            }
            else if (publishersPairsThatHaveGame.Count() == 2)
            {
                var standardPublisherPair    = publishersPairsThatHaveGame.Single(x => x.Publisher.PublisherGames.Where(y => !y.CounterPick).Where(y => y.MasterGame is not null).Any(y => y.MasterGame !.MasterGame.MasterGameID == masterGame.MasterGame.MasterGameID));
                var counterPickPublisherPair = publishersPairsThatHaveGame.Single(x => x.Publisher.PublisherID != standardPublisherPair.Publisher.PublisherID);
                LeagueID                 = standardPublisherPair.LeagueYear.League.LeagueID;
                Year                     = standardPublisherPair.LeagueYear.Year;
                LeagueName               = standardPublisherPair.LeagueYear.League.LeagueName;
                PublisherID              = standardPublisherPair.Publisher.PublisherID;
                PublisherName            = standardPublisherPair.Publisher.PublisherName;
                CounterPickPublisherID   = counterPickPublisherPair.Publisher.PublisherID;
                CounterPickPublisherName = counterPickPublisherPair.Publisher.PublisherName;
            }
            else
            {
                throw new Exception($"Problem with upcoming games. Happened for Game: {masterGame.MasterGame.GameName} and publisherIDs: {string.Join('|', publishersPairsThatHaveGame.Select(x => x.Publisher.PublisherID))}");
            }
        }
    }
 public RoyalePublisherGameViewModel(RoyalePublisherGame domain, IClock clock)
 {
     PublisherID      = domain.PublisherID;
     YearQuarter      = new RoyaleYearQuarterViewModel(domain.YearQuarter);
     MasterGame       = new MasterGameYearViewModel(domain.MasterGame, clock);
     Locked           = domain.IsLocked(clock);
     Timestamp        = domain.Timestamp;
     AmountSpent      = domain.AmountSpent;
     AdvertisingMoney = domain.AdvertisingMoney;
     FantasyPoints    = domain.FantasyPoints;
 }
 public PossibleMasterGameYearViewModel(PossibleMasterGameYear masterGame, LocalDate currentDate)
 {
     MasterGame           = new MasterGameYearViewModel(masterGame.MasterGame, currentDate);
     Taken                = masterGame.Taken;
     AlreadyOwned         = masterGame.AlreadyOwned;
     IsEligible           = masterGame.IsEligible;
     IsEligibleInOpenSlot = masterGame.IsEligibleInOpenSlot;
     IsReleased           = masterGame.IsReleased;
     WillRelease          = masterGame.WillRelease;
     HasScore             = masterGame.HasScore;
     IsAvailable          = masterGame.IsAvailable;
 }
        public async Task <ActionResult <MasterGameYearViewModel> > MasterGameYear(Guid id, int year)
        {
            Maybe <MasterGameYear> masterGame = await _interLeagueService.GetMasterGameYear(id, year);

            if (masterGame.HasNoValue)
            {
                return(NotFound());
            }

            var viewModel = new MasterGameYearViewModel(masterGame.Value, _clock);

            return(viewModel);
        }
Exemple #8
0
    public async Task <ActionResult <MasterGameYearViewModel> > MasterGameYear(Guid id, int year)
    {
        MasterGameYear?masterGame = await _interLeagueService.GetMasterGameYear(id, year);

        if (masterGame is null)
        {
            return(NotFound());
        }

        var currentDate = _clock.GetToday();
        var viewModel   = new MasterGameYearViewModel(masterGame, currentDate);

        return(viewModel);
    }
Exemple #9
0
 public RoyalePublisherGameViewModel(RoyalePublisherGame domain, LocalDate currentDate, IEnumerable <MasterGameTag> allMasterGameTags)
 {
     PublisherID         = domain.PublisherID;
     YearQuarter         = new RoyaleYearQuarterViewModel(domain.YearQuarter);
     MasterGame          = new MasterGameYearViewModel(domain.MasterGame, currentDate);
     Locked              = domain.IsLocked(currentDate, allMasterGameTags);
     Timestamp           = domain.Timestamp;
     AmountSpent         = domain.AmountSpent;
     AdvertisingMoney    = domain.AdvertisingMoney;
     FantasyPoints       = domain.FantasyPoints;
     CurrentlyIneligible = domain.CalculateIsCurrentlyIneligible(allMasterGameTags);
     RefundAmount        = AmountSpent;
     if (!CurrentlyIneligible)
     {
         RefundAmount /= 2;
     }
 }
Exemple #10
0
    public PublisherGameViewModel(FormerPublisherGame publisherGame, LocalDate currentDate)
    {
        PublisherGameID = publisherGame.PublisherGame.PublisherGameID;
        GameName        = publisherGame.PublisherGame.GameName;

        Timestamp     = publisherGame.PublisherGame.Timestamp.ToDateTimeUtc();
        CounterPick   = publisherGame.PublisherGame.CounterPick;
        FantasyPoints = publisherGame.PublisherGame.FantasyPoints;

        Linked = publisherGame.PublisherGame.MasterGame is not null;
        if (Linked)
        {
            GameName             = publisherGame.PublisherGame.MasterGame !.MasterGame.GameName;
            EstimatedReleaseDate = publisherGame.PublisherGame.MasterGame.MasterGame.EstimatedReleaseDate;
            if (publisherGame.PublisherGame.MasterGame.MasterGame.ReleaseDate.HasValue)
            {
                ReleaseDate = publisherGame.PublisherGame.MasterGame.MasterGame.ReleaseDate.Value.ToDateTimeUnspecified();
            }

            CriticScore = publisherGame.PublisherGame.MasterGame.MasterGame.CriticScore;
            Released    = publisherGame.PublisherGame.MasterGame.MasterGame.IsReleased(currentDate);
            if (publisherGame.PublisherGame.MasterGame is not null)
            {
                MasterGame = new MasterGameYearViewModel(publisherGame.PublisherGame.MasterGame, currentDate);
            }
        }

        if (publisherGame.PublisherGame.ManualCriticScore.HasValue)
        {
            CriticScore       = publisherGame.PublisherGame.ManualCriticScore;
            ManualCriticScore = true;
        }

        WillRelease          = publisherGame.PublisherGame.WillRelease();
        ManualWillNotRelease = publisherGame.PublisherGame.ManualWillNotRelease;
        OverallDraftPosition = publisherGame.PublisherGame.OverallDraftPosition;
        BidAmount            = publisherGame.PublisherGame.BidAmount;
        AcquiredInTradeID    = publisherGame.PublisherGame.AcquiredInTradeID;
        SlotNumber           = publisherGame.PublisherGame.SlotNumber;
        RemovedTimestamp     = publisherGame.RemovedTimestamp;
        RemovedNote          = publisherGame.RemovedNote;
    }
 public MasterGameYearWithCounterPickViewModel(MasterGameYear masterGameYear, bool counterPick, LocalDate currentDate)
 {
     MasterGameYear = new MasterGameYearViewModel(masterGameYear, currentDate);
     CounterPick    = counterPick;
 }
Exemple #12
0
 public PublicBiddingMasterGameViewModel(PublicBiddingMasterGame masterGame, LocalDate currentDate)
 {
     MasterGame        = new MasterGameYearViewModel(masterGame.MasterGameYear, currentDate);
     CounterPick       = masterGame.CounterPick;
     EligibilityErrors = masterGame.ClaimErrors.Select(x => x.Error).ToList();
 }