Planner: always create simple plan even if tariff errors (#19004)
This commit is contained in:
parent
21cb9bb110
commit
acbcf5461c
6 changed files with 54 additions and 46 deletions
|
|
@ -50,8 +50,8 @@ func planHandler(lp loadpoint.API) http.HandlerFunc {
|
|||
|
||||
goal, _ := lp.GetPlanGoal()
|
||||
requiredDuration := lp.GetPlanRequiredDuration(goal, maxPower)
|
||||
plan, err := lp.GetPlan(planTime, requiredDuration)
|
||||
if err != nil {
|
||||
plan := lp.GetPlan(planTime, requiredDuration)
|
||||
if plan == nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
@ -109,8 +109,8 @@ func staticPlanPreviewHandler(lp loadpoint.API) http.HandlerFunc {
|
|||
|
||||
maxPower := lp.EffectiveMaxPower()
|
||||
requiredDuration := lp.GetPlanRequiredDuration(goal, maxPower)
|
||||
plan, err := lp.GetPlan(planTime, requiredDuration)
|
||||
if err != nil {
|
||||
plan := lp.GetPlan(planTime, requiredDuration)
|
||||
if plan == nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
@ -162,8 +162,8 @@ func repeatingPlanPreviewHandler(lp loadpoint.API) http.HandlerFunc {
|
|||
|
||||
maxPower := lp.EffectiveMaxPower()
|
||||
requiredDuration := lp.GetPlanRequiredDuration(soc, maxPower)
|
||||
plan, err := lp.GetPlan(planTime, requiredDuration)
|
||||
if err != nil {
|
||||
plan := lp.GetPlan(planTime, requiredDuration)
|
||||
if plan == nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue