Planner: always create simple plan even if tariff errors (#19004)

This commit is contained in:
andig 2025-02-21 08:09:48 +01:00 • committed by GitHub
parent 21cb9bb110
commit acbcf5461c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 54 additions and 46 deletions

View file

@ -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
}