Skip to content

Commit

Permalink
Fix dough api
Browse files Browse the repository at this point in the history
Resolve bug in find_timeframe function
  • Loading branch information
=Cheng Hui committed Jun 5, 2012
1 parent f01c260 commit 1d3de2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dough/api.py
Expand Up @@ -180,13 +180,13 @@ def query_monthly_report(context, timestamp_from=None,
def find_timeframe(start_time, end_time, target):
target_utc = target.replace(tzinfo=UTC_TIMEZONE)
current_frame = start_time
month_cnt = 0
month_cnt = 1
while current_frame < end_time:
next_frame = current_frame + relativedelta(months=1)
next_frame = start_time + relativedelta(months=month_cnt)
if current_frame <= target_utc < next_frame:
break
month_cnt += 1
current_frame = start_time + relativedelta(months=month_cnt)
current_frame = next_frame
assert(current_frame < end_time)
return current_frame.isoformat()

Expand Down

0 comments on commit 1d3de2d

Please sign in to comment.