示例#1
0
        private DailyProgressSummary GetDailyProgress(string userId, DateTime dayDate)
        {
            var progress = _progressRepository.GetProgress(userId, dayDate, dayDate.AddDays(1));

            if (progress.IsNullOrEmpty())
            {
                return(new DailyProgressSummary());
            }

            return(progress.First());
        }
示例#2
0
        public WeeklyProgressSummary BuildWeeklyProgress(string userId, DateTime start, DateTime end)
        {
            if (userId.Equals(_localStorage.GetCurrentUserId()))
            {
                return(BuildForPlayer(start, end));
            }

            var playersProgress       = _progressRepository.GetProgress(userId, start, end);
            var weeklyProgressSummary = CalculateWeeklyByDays(playersProgress);

            return(weeklyProgressSummary);
        }
示例#3
0
        public DateTime GetLastSyncDate(string userId)
        {
            var end      = DateTime.Today;
            var start    = end - TimeSpan.FromDays(7);
            var progress = _progressRepository.GetProgress(userId, start, end);

            if (progress.IsNullOrEmpty())
            {
                return(start);
            }

            return(progress.Last().DayId);
        }
示例#4
0
 public List <Progress> GetProgress()
 {
     return(_progressRepository.GetProgress());
 }