Mercurial > gemma
changeset 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 |
files | pkg/controllers/fwa.go |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/fwa.go Tue May 12 10:45:52 2020 +0200 +++ b/pkg/controllers/fwa.go Tue May 12 11:00:50 2020 +0200 @@ -310,7 +310,7 @@ label, finish := interval(mode, from) - var shipableDays int + var totalDays, shipableDays int allClasses := make([][]time.Duration, len(validities)) missingLDCs := make([]int, len(validities)) @@ -362,16 +362,26 @@ if shipable { shipableDays++ } + totalDays++ // TODO: Accumulate daily statistics into time segment. if finish(next) { + record[0] = label(current) + + if availability { + record[1] = strconv.Itoa(totalDays - shipableDays) + record[2] = strconv.Itoa(shipableDays) + } else { + shPerc := float64(shipableDays) * 100 / float64(totalDays) + record[1] = fmt.Sprintf("%.3f", 100-shPerc) + record[2] = fmt.Sprintf("%.3f", shPerc) + } + // TODO: depending on mode write out results. - l := label(current) - _ = l // Reset counters - shipableDays = 0 + shipableDays, totalDays = 0, 0 } current = next