Fix not being able to fetch logs in a specific period
This commit is contained in:
parent
59c78e5eac
commit
9686e27ba3
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user