From 03ae9a5a8c4d5a3a28755014b58bebe9e9c264ae Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 7 Nov 2011 15:46:16 +0100 Subject: [PATCH] user/guest stats --- pandora/user/views.py | 3 ++- static/js/pandora/usersDialog.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index 667246f7..39479d03 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -518,7 +518,8 @@ Positions response['data']['positions'] = utils.get_positions(ids, data['positions']) else: response['data']['items'] = qs.count() - + response['data']['users'] = qs.exclude(user=None).count() + response['data']['guests'] = response['data']['items'] - response['data']['users'] return render_to_json_response(response) actions.register(findUsers) diff --git a/static/js/pandora/usersDialog.js b/static/js/pandora/usersDialog.js index 6319ed0f..6a33e61a 100644 --- a/static/js/pandora/usersDialog.js +++ b/static/js/pandora/usersDialog.js @@ -206,11 +206,12 @@ pandora.ui.usersDialog = function() { }) .bindEvent({ init: function(data) { - numberOfUsers = data.items; $status.html( - Ox.formatNumber(numberOfUsers) - + ' user' + (numberOfUsers == 1 ? '' : 's') - + ' (' + Ox.formatNumber(numberOfUsers) + ' registered, 0 guests)' + Ox.formatNumber(data.items) + + ' user' + (data.items == 1 ? '' : 's') + + ' (' + Ox.formatNumber(data.users) + ' registered, ' + + Ox.formatNumber(data.guests) + ' guest' + (data.guests == 1 ? '' : 's') + + ')' ); }, select: function(data) {