Mercurial > gemma
comparison pkg/controllers/fwa.go @ 5224:fc999a902d87 new-fwa
Write LCD columns.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 12 May 2020 11:00:50 +0200 |
parents | d4e4f7232513 |
children | c5599966befe |
comparison
equal
deleted
inserted
replaced
5223:d4e4f7232513 | 5224:fc999a902d87 |
---|---|
308 | 308 |
309 mode := parseFWAMode(req.FormValue("mode")) | 309 mode := parseFWAMode(req.FormValue("mode")) |
310 | 310 |
311 label, finish := interval(mode, from) | 311 label, finish := interval(mode, from) |
312 | 312 |
313 var shipableDays int | 313 var totalDays, shipableDays int |
314 | 314 |
315 allClasses := make([][]time.Duration, len(validities)) | 315 allClasses := make([][]time.Duration, len(validities)) |
316 missingLDCs := make([]int, len(validities)) | 316 missingLDCs := make([]int, len(validities)) |
317 | 317 |
318 // We step through the time in steps of one day. | 318 // We step through the time in steps of one day. |
360 } | 360 } |
361 | 361 |
362 if shipable { | 362 if shipable { |
363 shipableDays++ | 363 shipableDays++ |
364 } | 364 } |
365 totalDays++ | |
365 | 366 |
366 // TODO: Accumulate daily statistics into time segment. | 367 // TODO: Accumulate daily statistics into time segment. |
367 | 368 |
368 if finish(next) { | 369 if finish(next) { |
370 record[0] = label(current) | |
371 | |
372 if availability { | |
373 record[1] = strconv.Itoa(totalDays - shipableDays) | |
374 record[2] = strconv.Itoa(shipableDays) | |
375 } else { | |
376 shPerc := float64(shipableDays) * 100 / float64(totalDays) | |
377 record[1] = fmt.Sprintf("%.3f", 100-shPerc) | |
378 record[2] = fmt.Sprintf("%.3f", shPerc) | |
379 } | |
380 | |
369 // TODO: depending on mode write out results. | 381 // TODO: depending on mode write out results. |
370 l := label(current) | |
371 _ = l | |
372 | 382 |
373 // Reset counters | 383 // Reset counters |
374 shipableDays = 0 | 384 shipableDays, totalDays = 0, 0 |
375 } | 385 } |
376 | 386 |
377 current = next | 387 current = next |
378 } | 388 } |
379 | 389 |