Addon
This commit is contained in:
@@ -27,16 +27,18 @@ 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).
|
||||
// GetPlannerLongestTime returns the sum of all processing+service durations.
|
||||
// Returns -1 if any item is open-ended (no deadline).
|
||||
func GetPlannerLongestTime(planned map[tools.DataType]map[string]pricing.PricedItemITF) float64 {
|
||||
longestTime := float64(0)
|
||||
for _, priced := range planned[tools.PROCESSING_RESOURCE] {
|
||||
d := priced.GetExplicitDurationInS()
|
||||
if d < 0 {
|
||||
return -1 // service present: booking is open-ended
|
||||
for _, dt := range []tools.DataType{tools.PROCESSING_RESOURCE, tools.SERVICE_RESOURCE} {
|
||||
for _, priced := range planned[dt] {
|
||||
d := priced.GetExplicitDurationInS()
|
||||
if d < 0 {
|
||||
return -1
|
||||
}
|
||||
longestTime += d
|
||||
}
|
||||
longestTime += d
|
||||
}
|
||||
return longestTime
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user