public override QuestionnaireSummaryData CalculateSingleQuestionnaireCategoryScores(ServiceModel.Questionnaire.QuestionnaireTemplate answeredTemplate)
        {
            QuestionnaireSummaryData data = new QuestionnaireSummaryData()
            {
                Value = new List <double>()
            };


            for (int p = 0; p < answeredTemplate.QuestionCategories.Count; p++)
            {
                var score = answeredTemplate.QuestionCategories[p].Questions.Sum(q =>
                {
                    if (Math.Abs(q.QuestionAnwer.Answer - 3) < 0.001)
                    {
                        return(3);
                    }
                    return(q.QuestionAnwer.Answer + 1);
                });

                if (p == 0)
                {
                    data.Value.Add(GetEnergyCategoryElementScore(score));
                }
                if (p == 1)
                {
                    data.Value.Add(GetHealthCategoryElementScore(score));
                }
                if (p == 2)
                {
                    data.Value.Add(GetbiomechCategoryElementScore(score));
                }
                if (p == 3)
                {
                    data.Value.Add(GetTrainningCategoryElementScore(score));
                }
                if (p == 4)
                {
                    data.Value.Add(GetRecoveryCategoryElementScore(score));
                }
                if (p == 5)
                {
                    data.Value.Add(GetNutritionCategoryElementScore(score));
                }
                if (p == 6)
                {
                    data.Value.Add(GetMentalCategoryElementScore(score));
                }
            }

            return(data);
        }
예제 #2
0
        public virtual QuestionnaireSummaryData CalculateSingleQuestionnaireCategoryScores(QuestionnaireTemplate answeredTemplate)
        {
            var summaries = new QuestionnaireSummaryData {
            };

            for (int p = 0; p < answeredTemplate.QuestionCategories.Count; p++)
            {
                var sum = answeredTemplate.QuestionCategories[p].Questions.Sum(q => q.QuestionAnwer.Answer);

                summaries.Value.Add(sum);
            }

            return(summaries);
        }