Tweaks to aggregation

This commit is contained in:
2021-05-29 22:30:11 -04:00
parent 4cb2ebe75a
commit 70c73cc6b3
2 changed files with 8 additions and 5 deletions

View File

@@ -35,9 +35,9 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Controllers
[HttpGet("aggregate")]
public async Task<ActionResult<WeatherAggregate>> GetHistoryAggregate(DateTimeOffset start, DateTimeOffset end)
{
var readings = await _database.GetReadingHistory(start, end);
var readings = (await _database.GetReadingHistory(start, end)).ToList();
return new WeatherAggregate(readings);
return readings.Any() ? new WeatherAggregate(readings) : null;
}
[HttpGet("value-history")]