Example #1
0
        public async Task <Dictionary <string, double> > Calculate(EducationLine subject, bool isComlicatedMode = true)
        {
            Dictionary <string, double> sum;
            Dictionary <string, double> idealResult;

            var totalCharacteristics = _namesHelper.Names.ToDictionary <string, string, double>(name => name, name => 0);

            //Здесь выбираем метод которым формируем результат
            if (isComlicatedMode)
            {
                sum         = _educationLineSummator.CalculateComplicatedSum(subject);
                idealResult = await _idealResult.GetComplicatedResult();
            }
            else
            {
                sum         = _educationLineSummator.CalculateSimpleSum(subject);
                idealResult = await _idealResult.GetSimpleResult();
            }

            //Нормируем
            foreach (var item in sum)
            {
                totalCharacteristics[item.Key] = item.Value / idealResult[item.Key];
            }
            return(totalCharacteristics);
        }
Example #2
0
        public async Task <Dictionary <string, double> > GetSimpleResult()
        {
            if (_simpleResult == null)
            {
                var idealEducationLine = await _queryBuilder
                                         .For <Task <EducationLine> >()
                                         .With(new GetIdelaEducationLineForCharacterizerCriterion());

                _simpleResult = _summator.CalculateSimpleSum(idealEducationLine);
            }
            return(_simpleResult);
        }
Example #3
0
        public async Task <Dictionary <string, double> > GetSimpleResult()
        {
            if (_simpleResult == null)
            {
                var idealEntrant = await _queryBuilder
                                   .For <Task <Entrant> >()
                                   .With(new GetEntrantForCharacterizerCriterion {
                    EntrantId = 2
                });

                _simpleResult = _entrantSummator.CalculateSimpleSum(idealEntrant);
            }

            return(_simpleResult);
        }