@@ -162,14 +162,15 @@ func ReCalcCountyStatePrices() {
162162 log .Printf ("recalcCountyStatePrices started." )
163163 myStart := time .Now ()
164164 postCodePostCodeLocationMap , idStateDataMap , idCountyDataMap , postCodeGasStationsMap := createPostCodeGasStationMaps ()
165- gasStationIdGasPriceMap := createGasStationIdGasPriceMap (& postCodeGasStationsMap , Month )
166- log .Printf ("gasStationIdGasPriceMap: %v" , len (gasStationIdGasPriceMap ))
165+ //gasStationIdGasPriceMap := createGasStationIdGasPriceMap(&postCodeGasStationsMap, Month)
167166 resetDataMaps (& idStateDataMap , & idCountyDataMap )
168167 //sum up prices and count stations
169168 for _ , myPostCodeLocation := range postCodePostCodeLocationMap {
170169 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 {
173174 if myGasPrice .E5 < 10 && myGasPrice .E10 < 10 && myGasPrice .Diesel < 10 {
174175 continue
175176 }
@@ -234,10 +235,12 @@ func ReCalcCountyStatePrices() {
234235}
235236
236237func 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)
238239 postCodeTimeSliceBuckets := make (map [string ]map [time.Time ][]gsmodel.GasPrice )
239240 for _ , myPostCodeLocation := range postCodePostCodeLocationMap {
240241 myPostCode := postcode .FormatPostCode (myPostCodeLocation .PostCode )
242+ gasStations := postCodeGasStationsMap [myPostCode ]
243+ gasStationIdGasPriceMap := createGasStationIdGasPriceArrayMap (& gasStations , Day )
241244 for _ , myGasStation := range postCodeGasStationsMap [myPostCode ] {
242245 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 )
243246 //yesterday := time.Now().AddDate(0, 0, -1).Round(time.Hour)
@@ -350,6 +353,7 @@ func CalcCountyTimeSlots() {
350353 log .Printf ("calcCountyTimeSlots started." )
351354 myStart := time .Now ()
352355 postCodePostCodeLocationMap , _ , idCountyDataMap , postCodeGasStationsMap := createPostCodeGasStationMaps ()
356+
353357 postCodeTimeSliceBuckets := createCodeTimeSliceBuckets (postCodePostCodeLocationMap , postCodeGasStationsMap )
354358 //log.Printf("postCodeTimeSliceBuckets: %v\n", len(postCodeGasStationsMap))
355359 database .DB .Transaction (func (tx * gorm.DB ) error {
0 commit comments