Fix not being able to fetch logs in a specific period

This commit is contained in:
Reimar 2025-04-02 13:16:17 +02:00
parent 59c78e5eac
commit 9686e27ba3
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
2 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,7 @@ namespace Api.BusinessLogic
List<TemperatureLogs> rangedLogs = new List<TemperatureLogs>(); List<TemperatureLogs> rangedLogs = new List<TemperatureLogs>();
foreach (var log in logs) foreach (var log in logs)
{ {
if (log.Date <= dateTimeRange.DateTimeStart && log.Date >= dateTimeRange.DateTimeEnd) { rangedLogs.Add(log); } if (log.Date >= dateTimeRange.DateTimeStart && log.Date <= dateTimeRange.DateTimeEnd) { rangedLogs.Add(log); }
} }
return new OkObjectResult(rangedLogs); return new OkObjectResult(rangedLogs);

View File

@ -56,8 +56,8 @@ namespace Api.Controllers
} }
else else
{ {
dateTimeRange.DateTimeStart = DateTime.Now; dateTimeRange.DateTimeStart = DateTime.UnixEpoch;
dateTimeRange.DateTimeEnd = dateTimeRange.DateTimeStart; dateTimeRange.DateTimeEnd = DateTime.Now;
} }
return await _deviceLogic.GetLogs(dateTimeRange, deviceId); return await _deviceLogic.GetLogs(dateTimeRange, deviceId);
} }