Beispiel #1
0
        public WeeklyProgressSummary CalculateWeeklyByDays(DailyProgressSummary[] progress)
        {
            if (progress.IsNullOrEmpty())
            {
                return(new WeeklyProgressSummary());
            }

            var weeklyProgressSummary = new WeeklyProgressSummary()
            {
                ActiveMinutes      = progress.Sum(p => p.ActiveMinutes),
                ActiveMinutesGoal  = progress.Last().ActiveMinutesGoal,
                CaloriesBurned     = progress.Sum(p => p.CaloriesBurned),
                CaloriesBurnedGoal = progress.Sum(p => p.CaloriesBurnedGoal)
            };

            return(weeklyProgressSummary);
        }
Beispiel #2
0
        public WeeklyProgressSummary BuildForPlayer(DateTime start, DateTime end)
        {
            var dailySummaries = GetDailySummaries(start, end);

            if (dailySummaries.IsNullOrEmpty())
            {
                return(new WeeklyProgressSummary());
            }

            var activeMinutes = CalculateTotalActiveMinutes(dailySummaries);
            var calories      = CalculateTotalCalories(dailySummaries);

            var weeklygoals           = _goalsRepository.GetGoals(_localStorage.GetCurrentUserId());
            var weeklyProgressSummary = new WeeklyProgressSummary()
            {
                ActiveMinutes      = activeMinutes,
                ActiveMinutesGoal  = weeklygoals.WeeklyActiveMinutes,
                CaloriesBurned     = calories,
                CaloriesBurnedGoal = weeklygoals.WeeklyCaloriesBurned,
            };

            return(weeklyProgressSummary);
        }