From f8345a1223c1a02f973dc806463fae5d99ad4d33 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 1 May 2013 18:01:02 +0000 Subject: [PATCH] added timestamp to record users --- public/templates/footer.tpl | 2 +- src/user.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index 1036460e01..6d09ca3b16 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -40,7 +40,7 @@ }); socket.emit('api:user.active.get_record'); socket.on('api:user.active.get_record', function(data) { - active_record.innerHTML = "most users ever online was " + data + ""; + active_record.innerHTML = "most users ever online was " + data.record + " on " + (new Date(parseInt(data.timestamp,10))).toUTCString() + ""; }); socket.emit('api:user.get', { fields: ['username', 'picture'] }); socket.on('api:user.get', function(data) { diff --git a/src/user.js b/src/user.js index 08e9d3658a..59589271dc 100644 --- a/src/user.js +++ b/src/user.js @@ -257,8 +257,8 @@ var config = require('../config.js'), User.active = { get_record : function() { - RDB.get('global:active_user_record', function(record) { - socket.emit('api:user.active.get_record', record); + RDB.mget(['global:active_user_record', 'global:active_user_record_date'], function(data) { + socket.emit('api:user.active.get_record', {record: data[0], timestamp: data[1]}); }); }, @@ -267,6 +267,7 @@ var config = require('../config.js'), RDB.get('global:active_user_record', function(record) { if (total > record) { RDB.set('global:active_user_record', total); + RDB.set('global:active_user_record_date', new Date().getTime()); } }); }