예제 #1
0
        public IActionResult GetStatsForTracker([FromRoute] Guid trackerId)
        {
            Guid actorId          = Guid.Parse(User.FindFirstValue(JwtClaimTypes.Id));
            var  eventsWithRating = new Dictionary <Event, int>();
            var  events           = _eventService.GetEventsByTrackerId(actorId, trackerId);

            foreach (var @event in events)
            {
                var rating = _customizationService.GetRating(actorId, @event.Id);
                if (rating.IsSome)
                {
                    eventsWithRating.Add(@event, (int)rating.ValueUnsafe().Stars);
                }
            }

            return(Ok(StatsService.GetStatsFactsForTracker(eventsWithRating)));
        }