Пример #1
0
        private LifeSummaryItem EvaluateQualityOfLife(Engine engine, DateTime startDate, DateTime endDate)
        {
            Distribution thisQuality = engine.RatingSummarizer.GetValueDistributionForDates(startDate, endDate, true, true);

            string during  = TimeFormatter.summarizeTimespan(startDate, endDate);
            string subject = this.randomString(new List <string>()
            {
                "life has been", "life was", "things have been", "things were"
            });
            string obj = this.summarizeQuality(thisQuality.Mean, this.ActivityDatabase.RootActivity.Ratings);

            string text = during + " " + subject + " " + obj;

            return(new LifeSummaryItem(text, thisQuality.Mean, double.PositiveInfinity, startDate, endDate));
        }
Пример #2
0
        private LifeSummaryItem summarizeParticipation(Participation participation)
        {
            string         timespan     = TimeFormatter.summarizeTimespan(participation.StartDate, participation.EndDate);
            string         activityName = participation.ActivityDescriptor.ActivityName;
            double         participationScore;
            AbsoluteRating rating = participation.GetAbsoluteRating();

            if (rating != null)
            {
                participationScore = rating.Score;
            }
            else
            {
                participationScore = 0.5;
            }
            Activity     activity   = this.ActivityDatabase.ResolveDescriptor(participation.ActivityDescriptor);
            Distribution usualScore = activity.Ratings;
            string       quality    = this.summarizeQuality(participationScore, usualScore);
            string       summary;

            if (this.generator.Next(2) == 0)
            {
                summary = timespan + ", " + activityName;
            }
            else
            {
                summary = activityName + " " + timespan.ToLower();
            }
            summary += " was " + quality;
            double interest = Math.Abs(participationScore - 0.5);

            if (participation.Comment != null)
            {
                summary  += " " + participation.Comment;
                interest *= 2;
            }
            return(new LifeSummaryItem(summary, participationScore, interest, participation.StartDate, participation.EndDate));
        }