Exemple #1
0
        public HtmlString GetMostRecentAssessmentDateAsHtmlString()
        {
            var shortDateString = OnlandVisualTrashAssessments.Where(x => x.OnlandVisualTrashAssessmentStatusID ==
                                                                     OnlandVisualTrashAssessmentStatus.Complete
                                                                     .OnlandVisualTrashAssessmentStatusID).Max(x => x.CompletedDate)
                                  ?.ToShortDateString();

            return(shortDateString != null ? new HtmlString(shortDateString) : new HtmlString("<p class='systemText'>No assessment completed</p>"));
        }
Exemple #2
0
        public OnlandVisualTrashAssessmentScore CalculateScoreFromBackingData(bool calculateProgressScore)
        {
            var onlandVisualTrashAssessments = OnlandVisualTrashAssessments
                                               .Where(x => x.OnlandVisualTrashAssessmentStatusID ==
                                                      OnlandVisualTrashAssessmentStatus.Complete.OnlandVisualTrashAssessmentStatusID && x.IsProgressAssessment == calculateProgressScore).ToList();

            if (!onlandVisualTrashAssessments.Any())
            {
                return(null);
            }

            var average = onlandVisualTrashAssessments
                          .Average(x => x.OnlandVisualTrashAssessmentScore.NumericValue);

            var round = (int)Math.Round(average);

            return(OnlandVisualTrashAssessmentScore.All.SingleOrDefault(x => x.NumericValue == round));
        }