fix(types): humidity and temperature with from and till date

This commit is contained in:
2019-06-13 22:22:12 +02:00
parent 5220eac16b
commit a8aa7a14c5
6 changed files with 39 additions and 32 deletions

View File

@ -52,12 +52,12 @@ func GetTemperaturesBetweenTimeRange(from time.Time, till *time.Time, temperatur
cachedTemperatures := []*types.Temperature{}
for _, temperature := range temperatures {
if till == nil && temperature.TemperatureDate.After(from) {
if temperature.TemperatureFromDate.After(from) && till == nil {
cachedTemperatures = append(cachedTemperatures, temperature)
continue
}
if temperature.TemperatureDate.After(from) && temperature.TemperatureDate.Before(*till) {
if temperature.TemperatureFromDate.After(from) && temperature.TemperatureTillDate.Before(*till) {
cachedTemperatures = append(cachedTemperatures, temperature)
}
}