Merge pull request #123 from SamStudio8/master

Add stats to userlist [#117]
This commit is contained in:
Luke Slater 2013-01-11 14:41:21 -08:00
commit 4a2d28ce95
4 changed files with 61 additions and 14 deletions

View File

@ -33,26 +33,27 @@ var pages = function(dbot) {
if(channelUsers[i] == dbot.config.name){ if(channelUsers[i] == dbot.config.name){
continue; continue;
} }
var user = dbot.api.stats.getUserStats(connection, channelUsers[i], channel);
if(onlineNicks.hasOwnProperty(channelUsers[i])){ if(onlineNicks.hasOwnProperty(channelUsers[i])){
var user = dbot.api.users.resolveUser(connection, channelUsers[i]);
if(dbot.api.stats.isActive({'server': connection, if(dbot.api.stats.isActive({'server': connection,
'user': user, 'user': channelUsers[i],
'channel': channel 'channel': channel
})){ })){
userData.active.push(channelUsers[i]); userData.active.push(user);
} }
else{ else{
userData.inactive.push(channelUsers[i]); userData.inactive.push(user);
} }
} }
else{ else{
userData.offline.push(channelUsers[i]); userData.offline.push(user);
} }
} }
var userSort = function(a, b){ var userSort = function(a, b){
var x = a.toLowerCase(); var x = a.display.toLowerCase();
var y = b.toLowerCase(); var y = b.display.toLowerCase();
if(x > y) return 1; if(x > y) return 1;
if(x < y) return -1; if(x < y) return -1;
return 0; return 0;

View File

@ -14,3 +14,12 @@ wget http://twitter.github.com/bootstrap/assets/bootstrap.zip
unzip bootstrap.zip unzip bootstrap.zip
rm bootstrap.zip rm bootstrap.zip
``` ```
###d3.js
```
cd depressionbot/public/
mkdir d3
cd d3
wget http://d3js.org/d3.v3.zip
unzip d3.v3.zip
rm d3.v3.zip
```

View File

@ -14,5 +14,6 @@ html(lang='en')
div#main div#main
block content block content
script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js") script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js")
script(type="text/javascript", src="/d3/d3.v3.min.js")
script(type="text/javascript", src="/script.js") script(type="text/javascript", src="/script.js")

View File

@ -7,26 +7,62 @@ block content
div#row div#row
table.table.table-striped table.table.table-striped
thead thead
tr: th Users tr
th Users
th Lines
th Words
th Lincent
th Verbosity
th Mentions
tbody tbody
-each nick in nicks.active -each nick in nicks.active
tr tr
td td
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary)
#{nick} #{nick.display}
span span
span.label.label-success Active span.label.label-success Active
td
#{nick.total_lines}
td
#{nick.total_words}
td
#{nick.lincent}
td
#{nick.wpl}
td
#{nick.in_mentions}
-each nick in nicks.inactive -each nick in nicks.inactive
tr tr
td td
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary)
#{nick} #{nick.display}
span span
span.label.label-important Inactive span.label.label-important Inactive
td
#{nick.total_lines}
td
#{nick.total_words}
td
#{nick.lincent}
td
#{nick.wpl}
td
#{nick.in_mentions}
-each nick in nicks.offline -each nick in nicks.offline
tr tr
td td
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary)
#{nick} #{nick.display}
span span
span.label Offline span.label Offline
td
#{nick.total_lines}
td
#{nick.total_words}
td
#{nick.lincent}
td
#{nick.wpl}
td
#{nick.in_mentions}