added timestamp to record users

v1.18.x
psychobunny 12 years ago
parent b762ec275e
commit f8345a1223

@ -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 <strong>" + data + "</strong>";
active_record.innerHTML = "most users ever online was <strong>" + data.record + "</strong> on <strong>" + (new Date(parseInt(data.timestamp,10))).toUTCString() + "</strong>";
});
socket.emit('api:user.get', { fields: ['username', 'picture'] });
socket.on('api:user.get', function(data) {

@ -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());
}
});
}

Loading…
Cancel
Save