Skip to content

Commit

Permalink
Benefit comparator fix
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffxy committed Dec 12, 2023
1 parent 87a6c7c commit bef4d67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/brad/planner/compare/cost_with_benefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,21 @@ def _query_p90_ceiling(


def _transition_under_benefit_horizon(
left: ComparableBlueprint, right: ComparableBlueprint, payoff_period: timedelta
left: ComparableBlueprint, right: ComparableBlueprint, benefit_horizon: timedelta
) -> Optional[bool]:
left_tr_s = left.get_transition_time_s()
right_tr_s = right.get_transition_time_s()

# If either are above the payoff period, return the blueprint that does
# better on transition time.
if (
left_tr_s > payoff_period.total_seconds()
and right_tr_s > payoff_period.total_seconds()
left_tr_s >= benefit_horizon.total_seconds()
and right_tr_s >= benefit_horizon.total_seconds()
):
return left_tr_s < right_tr_s
elif left_tr_s > payoff_period.total_seconds():
elif left_tr_s >= benefit_horizon.total_seconds():
return False
elif right_tr_s > payoff_period.total_seconds():
elif right_tr_s >= benefit_horizon.total_seconds():
return True

return None
Expand Down

0 comments on commit bef4d67

Please sign in to comment.