Fix bug in get rates function.

This commit is contained in:
Rebecca Law
2017-07-25 15:50:14 +01:00
parent 5612ca023e
commit e23d38de26
3 changed files with 26 additions and 11 deletions

View File

@@ -129,8 +129,10 @@ def get_rates_for_daterange(start_date, end_date, notification_type):
results.append(rates[-1])
if not results:
if start_date >= rates[-1].valid_from:
results.append(rates[-1])
for x in reversed(rates):
if start_date >= x.valid_from:
results.append(x)
break
return results