Correct
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user