Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[bug 693304] Make AoA more tolerate of bad data.

* Be more careful checking data from metrics before using it.
* Try to allow partial data (e.g. no contributors).
* Handle extraneous "null" values.
  • Loading branch information...
commit 92cee09469078e579ec756701942fdecb5f7e27c 1 parent 3e11afe
James Socol authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 apps/customercare/views.py
View
8 apps/customercare/views.py
@@ -114,9 +114,11 @@ def landing(request):
# Stats. See customercare.cron.get_customercare_stats.
activity = cache.get(settings.CC_TWEET_ACTIVITY_CACHE_KEY)
- if activity:
+ if activity and 'resultset' in activity:
activity_stats = []
for act in activity['resultset']:
+ if act is None: # Sometimes we get bad data here.
+ continue
activity_stats.append((act[0], {
'requests': format_number(act[1], locale='en_US'),
'replies': format_number(act[2], locale='en_US'),
@@ -126,7 +128,7 @@ def landing(request):
activity_stats = []
contributors = cache.get(settings.CC_TOP_CONTRIB_CACHE_KEY)
- if contributors:
+ if contributors and 'resultset' in contributors:
contributor_stats = {}
for contrib in contributors['resultset']:
# Create one list per time period
@@ -144,7 +146,7 @@ def landing(request):
'avatar': contributors['avatars'].get(contrib[3]),
})
else:
- contributor_stats = []
+ contributor_stats = {}
return jingo.render(request, 'customercare/landing.html', {
'activity_stats': activity_stats,
Please sign in to comment.
Something went wrong with that request. Please try again.