Revize 0060a0ae
Přidáno uživatelem Roman Kalivoda před téměř 4 roky(ů)
Server/ServerApp/Predictor/PredictionController.cs | ||
---|---|---|
129 | 129 |
return response; |
130 | 130 |
} |
131 | 131 |
|
132 |
private Prediction PredictSingle(Request request, DateTime current)
|
|
132 |
private Prediction PredictSingle(Request request, DateTime predictionTime)
|
|
133 | 133 |
{ |
134 | 134 |
double[] predictedValues = new double[this.Configuration.BuildingsToAreas.Count]; |
135 | 135 |
string[] predictedLabels = new string[this.Predictors.Count]; |
... | ... | |
143 | 143 |
Rain = (float)request.rain, |
144 | 144 |
Temp = (float)request.temperature, |
145 | 145 |
Wind = (float)request.wind, |
146 |
Hour = current.Hour,
|
|
147 |
Time = current
|
|
146 |
Hour = predictionTime.Hour,
|
|
147 |
Time = predictionTime
|
|
148 | 148 |
}); |
149 | 149 |
} |
150 | 150 |
else |
151 | 151 |
{ |
152 | 152 |
_log.Debug("Retrieving weather info from the weather service."); |
153 | 153 |
weatherService.ParsePrediction(); |
154 |
WeatherInfo weatherInfo = weatherService.Predictions.Find(info => info.startTime.Equals(current));
|
|
154 |
WeatherInfo weatherInfo = weatherService.Predictions.Find(info => info.startTime.Date.Equals(predictionTime.Date) && predictionTime.TimeOfDay.Subtract(info.startTime.TimeOfDay).Hours < info.intervalLength);
|
|
155 | 155 |
if (weatherInfo is null) |
156 | 156 |
{ |
157 | 157 |
predictedLabels[i] = null; |
... | ... | |
163 | 163 |
Rain = weatherInfo.rain, |
164 | 164 |
Temp = (float)weatherInfo.temp, |
165 | 165 |
Wind = (float)weatherInfo.wind, |
166 |
Hour = current.Hour,
|
|
167 |
Time = current
|
|
166 |
Hour = predictionTime.Hour,
|
|
167 |
Time = predictionTime
|
|
168 | 168 |
}); |
169 | 169 |
} |
170 | 170 |
} |
... | ... | |
177 | 177 |
Prediction prediction = new Prediction(); |
178 | 178 |
prediction.dateTime = new Date |
179 | 179 |
{ |
180 |
year = current.Year,
|
|
181 |
month = current.Month,
|
|
182 |
day = current.Day,
|
|
183 |
hour = current.Hour
|
|
180 |
year = predictionTime.Year,
|
|
181 |
month = predictionTime.Month,
|
|
182 |
day = predictionTime.Day,
|
|
183 |
hour = predictionTime.Hour
|
|
184 | 184 |
}; |
185 | 185 |
prediction.predictions = predictedValues; |
186 | 186 |
_log.Debug($"Created prediction for DateTime: {prediction.dateTime}"); |
Také k dispozici: Unified diff
Re #9056 refactoring