Esempio n. 1
0
        public dynamic CalcAnswerWeights(int take)
        {
            var calculatedAnswers = Answers.AsQueryable().Select(x => new
            {
                x.Weight,
                x.PuzzleId,
                x.ScenarioId,
                x.RespondentId
            })
                                    .Where(x => x.RespondentId.Id != null)
                                    .Distinct()
                                    .GroupBy(x => x.RespondentId.Id)
                                    .Select(ag => new
            {
                UserId = new UserId("", ag.Key),     // todo тут channel надо ставить
                Weight = ag.Sum(x => x.Weight)
            })
                                    .OrderByDescending(x => x.Weight)
                                    .Take(take)
                                    .ToList();

            return(calculatedAnswers);
        }