Skip to content

Commit

Permalink
fix one off error in until
Browse files Browse the repository at this point in the history
  • Loading branch information
elpablete committed Feb 27, 2024
1 parent 529784a commit 6b20c3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/enerbitdso/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.7
0.1.8
4 changes: 2 additions & 2 deletions src/enerbitdso/enerbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ def get_schedule_measurement_records(
def fetch_schedule_usage_records_large_interval(
client: httpx.Client, frt_code: str, since: dt.datetime, until: dt.datetime
) -> list[ScheduleUsageRecord]:
number_of_requests = math.floor((until - since) / MAX_REQUEST_RANGE)
number_of_requests = math.ceil((until - since) / MAX_REQUEST_RANGE)
logger.debug(f"Fetching usages in {number_of_requests} requests")
usage_records = []
for i in range(0, number_of_requests):
fi = since + i * MAX_REQUEST_RANGE
ff = fi + MAX_REQUEST_RANGE
ff = min(fi + MAX_REQUEST_RANGE, until)
this_usage_records = get_schedule_usage_records(
client, frt_code, since=fi, until=ff
)
Expand Down

0 comments on commit 6b20c3a

Please sign in to comment.