From d932207db0a856fb9fc96e2c4063c29e11024a13 Mon Sep 17 00:00:00 2001 From: Eveldee Date: Mon, 29 Apr 2019 21:04:26 +0200 Subject: [PATCH] Fix broker historic manager --- PlantBox.Broker/HistoricManager.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/PlantBox.Broker/HistoricManager.cs b/PlantBox.Broker/HistoricManager.cs index 146309c..1d767a3 100644 --- a/PlantBox.Broker/HistoricManager.cs +++ b/PlantBox.Broker/HistoricManager.cs @@ -57,18 +57,21 @@ namespace PlantBox.Broker if (_minutesHistoric.Count % 12 == 0) { _hoursHistoric.Add(new CaptorsValue(GetAverage(_minutesHistoric.TakeFromEnd(12)))); - } - if (_hoursHistoric.Count % 24 == 0) - { - _daysHistoric.Add(new CaptorsValue(GetAverage(_hoursHistoric.TakeFromEnd(24)))); - } - if (_daysHistoric.Count % 7 == 0) - { - _weeksHistoric.Add(new CaptorsValue(GetAverage(_daysHistoric.TakeFromEnd(7)))); - } - if (_daysHistoric.Count % 31 == 0) - { - _monthsHistoric.Add(new CaptorsValue(GetAverage(_daysHistoric.TakeFromEnd(31)))); + + if (_hoursHistoric.Count % 24 == 0) + { + _daysHistoric.Add(new CaptorsValue(GetAverage(_hoursHistoric.TakeFromEnd(24)))); + + if (_daysHistoric.Count % 7 == 0) + { + _weeksHistoric.Add(new CaptorsValue(GetAverage(_daysHistoric.TakeFromEnd(7)))); + + if (_daysHistoric.Count % 31 == 0) + { + _monthsHistoric.Add(new CaptorsValue(GetAverage(_daysHistoric.TakeFromEnd(31)))); + } + } + } } }