Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Bug 852181] Make Contributors cron handle no data

  • Loading branch information...
commit 602a29bb575dc5cd01b2e9cc7793ad84eb1945b6 1 parent 5ff589d
@mythmon authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 apps/kpi/cron.py
View
8 apps/kpi/cron.py
@@ -244,8 +244,12 @@ def update_aoa_contributors_metric(day=None):
start = latest_metric.end + timedelta(days=1)
else:
# Start updating 30 days after the first reply we have.
- first_reply = Reply.objects.order_by('created')[0]
- start = first_reply.created.date() + timedelta(days=30)
+ replies = Reply.objects.order_by('created')
+ if replies:
+ start = replies[0].created.date() + timedelta(days=30)
+ else:
+ # If there are no replies, bail.
+ return
# Update until yesterday.
end = date.today() - timedelta(days=1)
Please sign in to comment.
Something went wrong with that request. Please try again.