Display proper online time in whos_online.js

This commit is contained in:
Bryan Ashby 2015-12-13 17:31:43 -07:00
parent 2a7dce9fac
commit 1b68264dc2
1 changed files with 6 additions and 1 deletions

View File

@ -71,13 +71,18 @@ WhosOnlineModule.prototype.mciReady = function(mciData, cb) {
var listFormat = self.menuConfig.config.listFormat || '{node} - {username} - {action} - {timeOn}';
var now = moment();
onlineListView.setItems(_.map(onlineList, function formatOnlineEntry(oe) {
return listFormat.format({
node : oe.node,
userId : oe.user.userId,
userName : oe.user.username,
realName : oe.user.properties.real_name,
timeOn : _.capitalize(moment.duration(55, 'minutes').humanize()),
timeOn : function getTimeOn() {
var diff = now.diff(moment(oe.user.properties.last_login_timestamp), 'minutes');
return _.capitalize(moment.duration(diff, 'minutes').humanize());
},
action : function getCurrentAction() {
var cmm = oe.currentMenuModule;
if(cmm) {