Exemplo n.º 1
0
        public ActionResult TopTabs()
        {
            DateTime maxTimestamp = SystemTime.Now();

            ICollection <UserWithScore> topLeaders = UserRepository.FindTop(Constants.ProductionDate, maxTimestamp, 0, Settings.TopUsers)
                                                     .Result.Select(u => new UserWithScore {
                User = u, Score = u.CurrentScore
            })
                                                     .ToList()
                                                     .AsReadOnly();

            //DateTime minTimestamp = maxTimestamp.AddDays(-1);

            //ICollection<UserWithScore> topMovers = UserRepository.FindTop(minTimestamp, maxTimestamp, 0, Settings.TopUsers)
            //                                                     .Result.Select(u => new UserWithScore { User = u, Score = u.GetScoreBetween(minTimestamp, maxTimestamp) })
            //                                                     .ToList()
            //                                                     .AsReadOnly();

            var viewData = new TopUserTabsViewData
            {
                TopLeaders = topLeaders,
                //TopMovers = topMovers
            };

            return(View(viewData));
        }
        public ActionResult TopTabs()
        {
            DateTime today            = SystemTime.Now();
            DateTime rankingStartDate = new DateTime(today.Year, today.Month, 1);

            ICollection <UserWithScore> topLeaders = UserRepository.FindTop(rankingStartDate, today, 0, Settings.TopUsers)
                                                     .Result.Select(u => new UserWithScore {
                User = u, Score = u.GetScoreBetween(rankingStartDate, today)
            })
                                                     .ToList()
                                                     .AsReadOnly();

            //DateTime minTimestamp = maxTimestamp.AddDays(-1);

            //ICollection<UserWithScore> topMovers = UserRepository.FindTop(minTimestamp, maxTimestamp, 0, Settings.TopUsers)
            //                                                     .Result.Select(u => new UserWithScore { User = u, Score = u.GetScoreBetween(minTimestamp, maxTimestamp) })
            //                                                     .ToList()
            //                                                     .AsReadOnly();

            var viewData = new TopUserTabsViewData
            {
                TopLeaders = topLeaders,
                //TopMovers = topMovers
            };

            return(View(viewData));
        }
        public ActionResult MonthTop()
        {
            DateTime today      = DateTime.Today;
            DateTime monthStart = new DateTime(today.Year, today.Month, 1);
            DateTime monthEnd   = today;

            ICollection <UserWithScore> topLeaders = UserRepository.FindTop(monthStart, monthEnd, 0, 5)
                                                     .Result.Select(u => new UserWithScore {
                User = u, Score = u.GetScoreBetween(monthStart, monthEnd)
            })
                                                     .ToList()
                                                     .AsReadOnly();
            var viewData = new TopUserTabsViewData
            {
                TopLeaders = topLeaders,
            };

            return(View(viewData));
        }
        public ActionResult Contest()
        {
            DateTime contestStartDate = new DateTime(2021, 09, 01);
            DateTime contestStopDate  = new DateTime(2021, 09, 11);
            DateTime today            = SystemTime.Now();
            DateTime maxTimestamp     = today > contestStopDate ? contestStopDate : today;

            ICollection <UserWithScore> topLeaders = UserRepository.FindTop(contestStartDate, maxTimestamp, 0, 5)
                                                     .Result.Select(u => new UserWithScore {
                User = u, Score = u.GetScoreBetween(contestStartDate, maxTimestamp)
            })
                                                     .ToList()
                                                     .AsReadOnly();
            var viewData = new TopUserTabsViewData
            {
                TopLeaders = topLeaders,
            };

            return(View(viewData));
        }