public SelectedTestViewModel(Test test) { _test = test; SelectedTest.Name = _test.Name; SelectedTest.Theme = _test.Theme; QuestionsCount = _test.Questions.Count; testStatistic = statisticLogic.GetTestStatistic(_test.Name); SelectedTestStatistic.AttempsCount = testStatistic.AttempsCount; SelectedTestStatistic.SuccessCount = testStatistic.SuccessCount; /// TODO if (testStatistic.AttempsCount > 0) { SelectedTestStatistic.SuccessRate = Math.Round((double)testStatistic.SuccessCount * 100 / testStatistic.AttempsCount, 2); SelectedTestStatistic.RightAnswersRate = Math.Round(testStatistic.RightAnswersProcent.AsQueryable().Sum() / testStatistic.AttempsCount, 2); } else { SelectedTestStatistic.SuccessRate = 0; SelectedTestStatistic.RightAnswersRate = 0; } Execution = new CommandParameter(); Execution.Test = test; }