@@ -162,14 +162,15 @@ func ReCalcCountyStatePrices() {
162
162
log .Printf ("recalcCountyStatePrices started." )
163
163
myStart := time .Now ()
164
164
postCodePostCodeLocationMap , idStateDataMap , idCountyDataMap , postCodeGasStationsMap := createPostCodeGasStationMaps ()
165
- gasStationIdGasPriceMap := createGasStationIdGasPriceMap (& postCodeGasStationsMap , Month )
166
- log .Printf ("gasStationIdGasPriceMap: %v" , len (gasStationIdGasPriceMap ))
165
+ //gasStationIdGasPriceMap := createGasStationIdGasPriceMap(&postCodeGasStationsMap, Month)
167
166
resetDataMaps (& idStateDataMap , & idCountyDataMap )
168
167
//sum up prices and count stations
169
168
for _ , myPostCodeLocation := range postCodePostCodeLocationMap {
170
169
myPostCode := postcode .FormatPostCode (myPostCodeLocation .PostCode )
171
- for _ , myGasStation := range postCodeGasStationsMap [myPostCode ] {
172
- for _ , myGasPrice := range gasStationIdGasPriceMap [myGasStation .ID ] {
170
+ gasStations := postCodeGasStationsMap [myPostCode ]
171
+ //log.Printf("gasStationIdGasPriceMap: %v", len(gasStations))
172
+ for _ , myGasStationPrices := range createGasStationIdGasPriceMap (& gasStations , Month ) {
173
+ for _ , myGasPrice := range myGasStationPrices {
173
174
if myGasPrice .E5 < 10 && myGasPrice .E10 < 10 && myGasPrice .Diesel < 10 {
174
175
continue
175
176
}
@@ -234,10 +235,12 @@ func ReCalcCountyStatePrices() {
234
235
}
235
236
236
237
func createCodeTimeSliceBuckets (postCodePostCodeLocationMap map [int ]pcmodel.PostCodeLocation , postCodeGasStationsMap map [string ][]gsmodel.GasStation ) map [string ]map [time.Time ][]gsmodel.GasPrice {
237
- gasStationIdGasPriceMap := createGasStationIdGasPriceArrayMap (& postCodeGasStationsMap , Day )
238
+ // gasStationIdGasPriceMap := createGasStationIdGasPriceArrayMap(&postCodeGasStationsMap, Day)
238
239
postCodeTimeSliceBuckets := make (map [string ]map [time.Time ][]gsmodel.GasPrice )
239
240
for _ , myPostCodeLocation := range postCodePostCodeLocationMap {
240
241
myPostCode := postcode .FormatPostCode (myPostCodeLocation .PostCode )
242
+ gasStations := postCodeGasStationsMap [myPostCode ]
243
+ gasStationIdGasPriceMap := createGasStationIdGasPriceArrayMap (& gasStations , Day )
241
244
for _ , myGasStation := range postCodeGasStationsMap [myPostCode ] {
242
245
yesterday := time .Date (time .Now ().Year (), time .Now ().Month (), time .Now ().Day (), 0 , 0 , 0 , 0 , time .Local ).AddDate (0 , 0 , - 1 ).Round (time .Hour )
243
246
//yesterday := time.Now().AddDate(0, 0, -1).Round(time.Hour)
@@ -350,6 +353,7 @@ func CalcCountyTimeSlots() {
350
353
log .Printf ("calcCountyTimeSlots started." )
351
354
myStart := time .Now ()
352
355
postCodePostCodeLocationMap , _ , idCountyDataMap , postCodeGasStationsMap := createPostCodeGasStationMaps ()
356
+
353
357
postCodeTimeSliceBuckets := createCodeTimeSliceBuckets (postCodePostCodeLocationMap , postCodeGasStationsMap )
354
358
//log.Printf("postCodeTimeSliceBuckets: %v\n", len(postCodeGasStationsMap))
355
359
database .DB .Transaction (func (tx * gorm.DB ) error {
0 commit comments