Mercurial > gemma
changeset 5228:f3a88039d822 new-fwa
Renamed variable shipable to overLDC to remove implicit semantics.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 12 May 2020 12:43:31 +0200 |
parents | fa55f403985b |
children | 0b051ee3f238 |
files | pkg/controllers/fwa.go |
diffstat | 1 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/fwa.go Tue May 12 12:38:31 2020 +0200 +++ b/pkg/controllers/fwa.go Tue May 12 12:43:31 2020 +0200 @@ -311,7 +311,7 @@ label, finish := interval(mode, from) - var totalDays, shipableDays int + var totalDays, overLDCDays int allClasses := make([][]time.Duration, len(validities)) minClasses := make([]time.Duration, len(validities)) @@ -322,8 +322,8 @@ next := current.AddDate(0, 0, 1) - // Assume that a bottleneck is shipable. - shipable := true + // Assume that a bottleneck is over LDC. + overLDC := true // check all bottlenecks for i, validity := range validities { @@ -344,15 +344,14 @@ continue } - if shipable { // If its already not shipable we need no further tests. + if overLDC { // If its already not shipable we need no further tests. result := bottlenecks[i].measurements.classify( current, next, ldc.value, (*availMeasurement).getValue) - // If more than half of the day is below LDC -> not shipable. if result[1] < 12*time.Hour { - shipable = false + overLDC = false } } @@ -362,8 +361,8 @@ limitingAccess[vs.limiting]) } - if shipable { - shipableDays++ + if overLDC { + overLDCDays++ } totalDays++ @@ -375,18 +374,18 @@ record[0] = label(current) if availability { - record[1] = strconv.Itoa(totalDays - shipableDays) - record[2] = strconv.Itoa(shipableDays) + record[1] = strconv.Itoa(totalDays - overLDCDays) + record[2] = strconv.Itoa(overLDCDays) } else { - shPerc := float64(shipableDays) * 100 / float64(totalDays) - record[1] = fmt.Sprintf("%.3f", 100-shPerc) - record[2] = fmt.Sprintf("%.3f", shPerc) + overPerc := float64(overLDCDays) * 100 / float64(totalDays) + record[1] = fmt.Sprintf("%.3f", 100-overPerc) + record[2] = fmt.Sprintf("%.3f", overPerc) } // TODO: depending on mode write out results. // Reset counters - shipableDays, totalDays = 0, 0 + overLDCDays, totalDays = 0, 0 } current = next