This commit is contained in:
mr
2026-03-20 16:14:07 +01:00
parent 9f861e5b8d
commit 88d2e52628
5 changed files with 149 additions and 61 deletions

View File

@@ -1,7 +1,6 @@
package common
import (
"fmt"
"time"
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
@@ -28,11 +27,16 @@ func GetPlannerNearestStart(start time.Time, planned map[tools.DataType]map[stri
return near
}
// GetPlannerLongestTime returns the sum of all processing durations (conservative estimate).
// Returns -1 if any processing is a service (open-ended).
func GetPlannerLongestTime(planned map[tools.DataType]map[string]pricing.PricedItemITF) float64 {
longestTime := float64(0)
for _, priced := range planned[tools.PROCESSING_RESOURCE] {
longestTime += priced.GetExplicitDurationInS()
fmt.Println("Longest", longestTime)
d := priced.GetExplicitDurationInS()
if d < 0 {
return -1 // service present: booking is open-ended
}
longestTime += d
}
return longestTime
}