Skip to content

Commit 1748356

Browse files
committed
fix: calc
1 parent b79addf commit 1748356

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

backend/pkd/cron/cron.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ func Start() {
117117

118118
scheduler.Every(60).Seconds().Tag("messaging").Do(messaging.ConnectionCheck)
119119

120-
scheduler.Every(1).Day().At("01:32").Tag("timeslices").Do(gasstation.CalcCountyTimeSlots)
120+
scheduler.Every(1).Day().At("00:02").Tag("timeslices").Do(gasstation.CalcCountyTimeSlots)
121121

122-
scheduler.Every(1).Day().At("03:05").Tag("averages").Do(gasstation.ReCalcCountyStatePrices)
122+
scheduler.Every(1).Day().At("02:05").Tag("averages").Do(gasstation.ReCalcCountyStatePrices)
123123

124124
msgFileStr := os.Getenv("MSG_MESSAGES")
125125
if len(strings.TrimSpace(msgFileStr)) > 3 {

backend/pkd/gasstation/gsrepo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ func createCodeTimeSliceBuckets(postCodePostCodeLocationMap map[int]pcmodel.Post
233233
for _, myPostCodeLocation := range postCodePostCodeLocationMap {
234234
myPostCode := postcode.FormatPostCode(myPostCodeLocation.PostCode)
235235
for _, myGasStation := range postCodeGasStationsMap[myPostCode] {
236-
yesterday := time.Now().AddDate(0, 0, -1)
237-
//10 min slices
236+
yesterday := time.Now().AddDate(0, 0, -1).Round(time.Hour)
237+
//15 min slices
238238
timeSlices := make([]time.Time, 0)
239-
//10 min buckets
239+
//15 min buckets
240240
timeSliceBuckets := make(map[time.Time][]gsmodel.GasPrice)
241-
for myTimeSlice := yesterday; myTimeSlice.Before(time.Now()); myTimeSlice = myTimeSlice.Add(time.Minute * 10) {
241+
for myTimeSlice := yesterday; myTimeSlice.Before(time.Now()); myTimeSlice = myTimeSlice.Add(time.Minute * 15) {
242242
timeSlices = append(timeSlices, myTimeSlice)
243243
timeSliceBuckets[myTimeSlice] = make([]gsmodel.GasPrice, 0)
244244
}

0 commit comments

Comments
 (0)