Update Weather to .NET 8 and add telemetry

This commit is contained in:
2024-01-25 16:25:59 -05:00
parent 2394f613d2
commit 5d0bc2c31c
28 changed files with 856 additions and 775 deletions

View File

@@ -1,25 +1,17 @@
using ChrisKaczor.HomeMonitor.Weather.Models;
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using ChrisKaczor.HomeMonitor.Weather.Models;
using JetBrains.Annotations;
namespace ChrisKaczor.HomeMonitor.Weather.Service.Models
namespace ChrisKaczor.HomeMonitor.Weather.Service.Models;
[PublicAPI]
public class ReadingAggregate(IEnumerable<WeatherReading> readings, Func<WeatherReading, decimal> selector, int decimalPlaces)
{
[PublicAPI]
public class ReadingAggregate
{
public decimal Min { get; set; }
public decimal Min { get; set; } = readings.Min(selector);
public decimal Max { get; set; }
public decimal Max { get; set; } = readings.Max(selector);
public decimal Average { get; set; }
public ReadingAggregate(IEnumerable<WeatherReading> readings, Func<WeatherReading, decimal> selector, int decimalPlaces)
{
Min = readings.Min(selector);
Max = readings.Max(selector);
Average = readings.Average(selector).Truncate(decimalPlaces);
}
}
public decimal Average { get; set; } = readings.Average(selector).Truncate(decimalPlaces);
}