Skip to content

Commit

Permalink
Merge pull request #11 from badguy99/idx_out_of_range_lookahead
Browse files Browse the repository at this point in the history
Fix IndexError: list index out of range
  • Loading branch information
badguy99 authored Jun 6, 2020
2 parents 07d4a1c + 515b298 commit fdff4a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/octoblock/octoblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def is_price_below_x(self):
api_date_now = self.dt_to_api_date(now_utc_flr)
i = self.date_to_idx(tariffresults, api_date_now)

for n in range (i, self.duration_ahead*2+i):
for n in range (i, min(self.duration_ahead*2+i, len(tariffresults) - 1)):
period_cost = tariffresults[n]['value_inc_vat']
if period_cost:
if self.operation == 'below':
Expand Down

0 comments on commit fdff4a2

Please sign in to comment.