private MultiSeriesGetRp InternalGetDailyJourneySeries(ProductEntity product, DateTime start, DateTime end) { var result = new MultiSeriesGetRp { Start = start, End = end, Name = product.Name, Avatar = product.Avatar }; var period = new DatePeriodValue(start, end); var agg = new ProductDailyAggregate(product, period); var response = agg.MeasureQuality(); var debtSerie = new MultiSerieItemGetRp() { Name = "Debt", Avatar = product.Avatar }; foreach (var item in response.OrderBy(c => c.Date)) { debtSerie.Items.Add(new SeriesItemGetRp(item.Date, item.Measure.AvailabilityDebt)); } result.Series.Add(debtSerie); return(result); }
public async Task <JourneyGroupListRp> GetJourneyGroupReport(int productId, DatePeriodValue period) { var entity = await this._dbContext.FullLoadProductWithSourceItems(productId, period.Start, period.End); var result = new JourneyGroupListRp(); var days = period.ToDaysPeriods(); foreach (var group in entity.Journeys.GroupBy(c => c.Group)) { var serie = new MultiSerieItemGetRp() { Name = group.Key }; foreach (var day in days) { serie.Items.Add(new SeriesItemGetRp(day.Start, group.Select(c => c.Measure(day).AvailabilityDebt).Sum())); } var measures = group.Select(c => new { measure = c.Measure(period) }).ToList(); var temp = new JourneyGroupListRp.JourneyGrouptem { Name = group.Key, AvailabilitySloAvg = QualityUtils.CalculateAverage(group.Select(c => c.AvailabilitySlo)), AvailabilitySloMin = QualityUtils.CalculateMinimum(group.Select(c => c.AvailabilitySlo)), LatencySloAvg = QualityUtils.CalculateAverage(group.Select(c => c.LatencySlo)), LatencySloMin = QualityUtils.CalculateMinimum(group.Select(c => c.LatencySlo)), ExperienceSloAvg = QualityUtils.CalculateAverage(group.Select(c => c.ExperienceSlo)), ExperienceSloMin = QualityUtils.CalculateMinimum(group.Select(c => c.ExperienceSlo)) }; temp.AvailabilityAvg = QualityUtils.CalculateAverage(measures.Select(c => c.measure.Availability)); temp.AvailabilityMin = QualityUtils.CalculateMinimum(measures.Select(c => c.measure.Availability)); temp.LatencyAvg = QualityUtils.CalculateAverage(measures.Select(c => c.measure.Latency)); temp.LatencyMin = QualityUtils.CalculateMinimum(measures.Select(c => c.measure.Latency)); temp.ExperienceAvg = QualityUtils.CalculateAverage(measures.Select(c => c.measure.Experience)); temp.ExperienceMin = QualityUtils.CalculateMinimum(measures.Select(c => c.measure.Experience)); temp.Count = group.Count(); temp.AvailabilityDebt = measures.Sum(c => c.measure.AvailabilityDebt); temp.ExperienceDebt = measures.Sum(c => c.measure.ExperienceDebt); temp.LatencyDebt = measures.Sum(c => c.measure.LatencyDebt); result.Series.Add(serie); result.Items.Add(temp); } return(result); }
public async Task <MultiSerieItemGetRp> GetAnnualJourneyGroupCalendarReport(int journeyId, DateTime start) { var result = new MultiSerieItemGetRp(); var period = DatePeriodValue.ToYearFromStart(start); var journey = await this._dbContext.FullJourneyWithSourceItems(journeyId, period.Start, period.End); var days = period.ToDaysPeriods(); result.Avatar = journey.Avatar; result.Name = journey.Name; foreach (var day in days) { var measure = journey.Measure(day); result.Items.Add(new SeriesItemGetRp(day.Start, measure.Availability)); } return(result); }
public async Task <IEnumerable <MultiSerieItemGetRp> > GetAnnualJourneyGroupCalendarReport(int productId, string group, DateTime start) { var period = DatePeriodValue.ToYearFromStart(start); var product = await this._dbContext.FullLoadProductWithGroupAndSourceItems(productId, group, period.Start, period.End); var result = new List <MultiSerieItemGetRp>(); var root = new MultiSerieItemGetRp(); root.Name = group; var days = period.ToDaysPeriods(); foreach (var day in days) { root.Items.Add( new SeriesItemGetRp(day.Start, product.Journeys.Select(c => c.Measure(day).AvailabilityDebt).Sum()) ); } result.Add(root); return(result); }