private AgeHistogramV2Model HandleGetAgeHistogramV2(HistoricalPdfStats currentPdfData) { _logger.LogInformation($"Hanling {nameof(GetAgeHistogramV2)}"); var response = new AgeHistogramV2Model() { Histogram = new Dictionary <AgeRange, int>() }; if (currentPdfData?.CurrentDayStats != null) { response.DatePublished = currentPdfData.CurrentDayStats.ParsedOn; response.DatePublishedString = currentPdfData.CurrentDayStats.ParsedOnString; response.Histogram = currentPdfData.CurrentDayStats.DistributionByAge; response.Total = currentPdfData.CurrentDayStats.DistributionByAge.Sum(x => x.Value); } response.DataLastUpdatedOn = currentPdfData?.LasUpdatedOn ?? 0; response.DataLastUpdatedOnString = currentPdfData?.LasUpdatedOnString; return(response); }
private AgeHistogramV2Model HandleGetAgeHistogramV2(HistoricalPdfStats data) { _logger.LogInformation($"Hanling {nameof(GetAgeHistogramV2)}"); var updateDetails = GetLastUpdatedDates(data, "ageHistogram"); var response = new AgeHistogramV2Model { Histogram = new Dictionary <AgeRange, int>() }; if (data?.CurrentDayStats != null) { response.DatePublished = data.CurrentDayStats.ParsedOn; response.DatePublishedString = data.CurrentDayStats.ParsedOnString; response.Histogram = data.CurrentDayStats.DistributionByAge; response.Total = data.CurrentDayStats.DistributionByAge.Sum(x => x.Value); } response.DataLastUpdatedOn = updateDetails.lastUpdatedOn; response.DataLastUpdatedOnString = updateDetails.lastUpdatedOnString; response.Stale = updateDetails.stale; return(response); }