/// <summary>
        ///     Gets the cumulative score for the specified player for each day on which the score changed.
        /// </summary>
        /// <param name="id">The player's unique user ID (usually a GUID).</param>
        /// <returns>IHttpActionResult.</returns>
        public IHttpActionResult Get(string id)
        {
            var spec      = new SingleUserWithObservations(id);
            var maybeUser = uow.Users.GetMaybe(spec);

            if (maybeUser.None)
            {
                return(BadRequest("no such user"));
            }
            var user       = maybeUser.Single();
            var groupQuery = from observation in user.Observations
                             where observation.Status == ModerationState.Approved
                             orderby observation.ObservationDateTimeUtc
                             let dt                       = observation.ObservationDateTimeUtc
                                                 let date = dt.Date
                                                            group observation by date
                                                            into days
                                                            select new { Date = days.Key, Score = days.Sum(p => p.Challenge.Points) };
            var dailyScores  = groupQuery.ToList();
            var dayCount     = dailyScores.Count;
            var scores       = new List <int>(dayCount);
            var dates        = new List <string>(dayCount);
            var runningTotal = 0;

            foreach (var day in dailyScores)
            {
                runningTotal += day.Score;
                scores.Add(runningTotal);
                dates.Add($"{day.Date:yyyy-MM-dd}");
            }
            var pointsJournal = new { dates, scores };

            return(Ok(pointsJournal));
        }
        public ActionResult Index()
        {
            var userId        = User.Identity.GetUserId();
            var specification = new SingleUserWithObservations(userId);
            var maybeUser     = uow.Users.GetMaybe(specification);

            if (maybeUser.None)
            {
                return(new HttpStatusCodeResult(500, "Unable to retrieve webUser details. Sorry!"));
            }
            return(View(maybeUser.Single().Observations));
        }