mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
Testing rolling week [#216]
This commit is contained in:
parent
c353069213
commit
13e24bbdbb
@ -26,18 +26,24 @@ var pages = function(dbot) {
|
|||||||
if(connections.hasOwnProperty(connection) &&
|
if(connections.hasOwnProperty(connection) &&
|
||||||
connections[connection].channels.hasOwnProperty(channel)) {
|
connections[connection].channels.hasOwnProperty(channel)) {
|
||||||
|
|
||||||
var chanData = dbot.api.stats.getChanStats(connection, channel, ["freq"]);
|
//TODO(samstudio8): Stats API Functionality
|
||||||
|
var chanData = dbot.api.stats.getChanStats(connection, channel, ["week"]);
|
||||||
var chanFreq = [];
|
var chanFreq = [];
|
||||||
|
var chanFreqLabel = [];
|
||||||
|
|
||||||
if(chanData){
|
if(chanData){
|
||||||
|
var cur_ptr;
|
||||||
for(var i=0; i <= 6; i++){
|
for(var i=0; i <= 6; i++){
|
||||||
|
cur_ptr = ((i+1)+chanData.fields.week.raw.ptr) % 7;
|
||||||
for(var j=0; j <= 23; j++){
|
for(var j=0; j <= 23; j++){
|
||||||
chanFreq.push(chanData.fields.freq.raw[i][j]);
|
chanFreq.push(chanData.fields.week.raw[cur_ptr][j]);
|
||||||
}
|
}
|
||||||
|
chanFreqLabel.push("'"+chanData.fields.week.raw[cur_ptr].name+"'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for (var i = 0; i < 168; i++) chanFreq[i] = 0;
|
for (var i = 0; i < 168; i++) chanFreq[i] = 0;
|
||||||
|
chanFreqLabel = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
||||||
}
|
}
|
||||||
|
|
||||||
var userData = { "active": [], "inactive": [], "offline": []};
|
var userData = { "active": [], "inactive": [], "offline": []};
|
||||||
@ -79,7 +85,10 @@ var pages = function(dbot) {
|
|||||||
'channel': channel,
|
'channel': channel,
|
||||||
'userStats': userDataSorted,
|
'userStats': userDataSorted,
|
||||||
'chanFreq': chanFreq,
|
'chanFreq': chanFreq,
|
||||||
'chanFreqLen': chanFreq.length });
|
'chanFreqLen': chanFreq.length,
|
||||||
|
"locals": {
|
||||||
|
'chanFreqLabel': chanFreqLabel,
|
||||||
|
}});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
res.render_core('error', { 'name': dbot.config.name, 'message': 'No such connection or channel.' });
|
res.render_core('error', { 'name': dbot.config.name, 'message': 'No such connection or channel.' });
|
||||||
|
@ -94,7 +94,7 @@ block content
|
|||||||
.text(String);
|
.text(String);
|
||||||
|
|
||||||
chart.selectAll("text.days")
|
chart.selectAll("text.days")
|
||||||
.data(["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"])
|
.data([!{locals.chanFreqLabel}])
|
||||||
.enter().append("text")
|
.enter().append("text")
|
||||||
.attr("x", function(d, i){ return ((i+0.5) * w * 24) + ticks; })
|
.attr("x", function(d, i){ return ((i+0.5) * w * 24) + ticks; })
|
||||||
.attr("y", h + 25)
|
.attr("y", h + 25)
|
||||||
@ -149,6 +149,7 @@ block content
|
|||||||
div#backlink
|
div#backlink
|
||||||
a(href='/channels/'+connection) « Channel List
|
a(href='/channels/'+connection) « Channel List
|
||||||
div#row
|
div#row
|
||||||
|
h4 Seven Day Activity
|
||||||
div.barchart#chanFreqChart
|
div.barchart#chanFreqChart
|
||||||
hr
|
hr
|
||||||
div#row
|
div#row
|
||||||
|
Loading…
Reference in New Issue
Block a user