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){
continue;
}
var user = dbot.api.stats.getUserStats(connection, channelUsers[i], channel);
if(onlineNicks.hasOwnProperty(channelUsers[i])){
var user = dbot.api.users.resolveUser(connection, channelUsers[i]);
if(dbot.api.stats.isActive({'server': connection,
'user': user,
'user': channelUsers[i],
'channel': channel
})){
userData.active.push(channelUsers[i]);
userData.active.push(user);
}
else{
userData.inactive.push(channelUsers[i]);
userData.inactive.push(user);
}
}
else{
userData.offline.push(channelUsers[i]);
userData.offline.push(user);
}
}
var userSort = function(a, b){
var x = a.toLowerCase();
var y = b.toLowerCase();
var x = a.display.toLowerCase();
var y = b.display.toLowerCase();
if(x > y) return 1;
if(x < y) return -1;
return 0;

View File

@ -14,3 +14,12 @@ wget http://twitter.github.com/bootstrap/assets/bootstrap.zip
unzip 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
block content
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")

View File

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