comparison pkg/controllers/fwa.go @ 5217:70d83b7d36ef new-fwa

Track the number days LDCs are not available at bottlenecks.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 11 May 2020 19:52:25 +0200
parents 91feaf7ac486
children 7dbb7cc6dbfa
comparison
equal deleted inserted replaced
5216:91feaf7ac486 5217:70d83b7d36ef
285 label, finish := interval(mode, from) 285 label, finish := interval(mode, from)
286 286
287 var shipableDays int 287 var shipableDays int
288 288
289 allClasses := make([][]time.Duration, len(validities)) 289 allClasses := make([][]time.Duration, len(validities))
290 missingLDCs := make([]int, len(validities))
290 291
291 // We step through the time in steps of one day. 292 // We step through the time in steps of one day.
292 for current := from; current.Before(to); { 293 for current := from; current.Before(to); {
293 294
294 next := current.AddDate(0, 0, 1) 295 next := current.AddDate(0, 0, 1)
309 } 310 }
310 311
311 // Let's see if we have a LDC for this day. 312 // Let's see if we have a LDC for this day.
312 ldc := vs.ldcs.find(current, next) 313 ldc := vs.ldcs.find(current, next)
313 if ldc == nil { 314 if ldc == nil {
314 // TODO: log missing LCD 315 missingLDCs[i]++
315 continue 316 continue
316 } 317 }
317 318
318 if shipable { // If its already not shipable we need no further tests. 319 if shipable { // If its already not shipable we need no further tests.
319 result := bottlenecks[i].measurements.classify( 320 result := bottlenecks[i].measurements.classify(
328 329
329 allClasses[i] = bottlenecks[i].measurements.classify( 330 allClasses[i] = bottlenecks[i].measurements.classify(
330 current, next, 331 current, next,
331 chooseBreaks[vs.limiting], 332 chooseBreaks[vs.limiting],
332 limitingAccess[vs.limiting]) 333 limitingAccess[vs.limiting])
333
334 } 334 }
335 335
336 if shipable { 336 if shipable {
337 shipableDays++ 337 shipableDays++
338 } 338 }
348 shipableDays = 0 348 shipableDays = 0
349 } 349 }
350 350
351 current = next 351 current = next
352 } 352 }
353
354 // TODO: Log missing LDCs
353 } 355 }
354 356
355 func dusk(t time.Time) time.Time { 357 func dusk(t time.Time) time.Time {
356 return time.Date( 358 return time.Date(
357 t.Year(), 359 t.Year(),