From 8d3ba66bb4bd6f1d203b0f5799898c6e0cbef9ed Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 25 Mar 2013 09:39:35 +0530 Subject: [PATCH] update statistics dialog (only show top 1000 cities) --- static/js/pandora/statisticsDialog.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/static/js/pandora/statisticsDialog.js b/static/js/pandora/statisticsDialog.js index 80630474c..4ccef7fb6 100644 --- a/static/js/pandora/statisticsDialog.js +++ b/static/js/pandora/statisticsDialog.js @@ -140,10 +140,10 @@ pandora.ui.statisticsDialog = function() { if (item.location) { split = item.location.split(', ') if (split.length == 1) { - country = item.location; + country = split[0]; } else { - country = split[1]; city = split[0]; + country = split[1]; } countryData = Ox.getCountryByName(country) || {continent: '', region: ''}; continent = countryData.continent; @@ -247,14 +247,6 @@ pandora.ui.statisticsDialog = function() { }); - data.all.city['Antarctica, Antarctica, Neutral Zone, Other'] = 0; - Ox.forEach(data.all.city, function(value, key) { - if (value < 2) { - data.all.city['Antarctica, Antarctica, Neutral Zone, Other']++; - delete data.all.city[key]; - } - }); - $guestsCheckbox = Ox.Checkbox({ title: 'Include Guests', value: false @@ -414,10 +406,17 @@ pandora.ui.statisticsDialog = function() { }, keyAlign: 'right', keyWidth: 128, + limit: 1000, sort: {key: 'value', operator: '-'}, - title: Ox.endsWith(key, 'y') + title: ( + Ox.endsWith(key, 'y') ? Ox.toTitleCase(key).slice(0, -1) + 'ies' - : Ox.toTitleCase(key) + 's', + : Ox.toTitleCase(key) + 's' + ) + ' (' + ( + Ox.len(data[mode][key]) > 1000 + ? '1,000 of ' + : '' + ) + Ox.formatNumber(Ox.len(data[mode][key])) + ')', width: chartWidth }) .css({