var hour = line.start.format('H');
var project = line.project;
hours[hour] = (typeof(hours[hour]) == 'undefined') ? {} : hours[hour];
- hours[hour][project] = (typeof(hours[project]) == 'undefined') ?
+ hours[hour][project] = (typeof(hours[hour][project]) == 'undefined') ?
{ total : 0, items : [] }
- : hours[project];
+ : hours[hour][project];
hours[hour][project].total += line.span;
hours[hour][project].items.push(line);
}
},
parseLine : function(l)
{
- var ret = { cmd : false, line : l };
+ var ret = { cmd : false, line : l, span : 0 };
var ar = l.split(/\s+/);
- print(JSON.stringify(ar));
+ //print(JSON.stringify(ar));
var time = ar.shift();
- print("time: " + time);
+ //print("time: " + time);
ret.start = xDate.Date.parseDate(this.date.format('Y-m-d') + ' ' + time, 'Y-m-d H:i:s');
while (ret.cmd === false) {
var ta = ar.pop();
- print("TA:"+ta)
+ //print("TA:"+ta)
if (ta[0] != '-') { //hopfully withc catch stuff.
ret.cmd = ta;
break;
}
if (!ar.length) {
// just assume it's the last bit..
- print(line);
+ //print(line);
throw "invalid line: " + l;
}
}
- print(ret.cmd);
+ //print(ret.cmd);
ret.title = ar.join(' ');
}
var res = GitLogParser.parse(xDate.Date.parseDate('2012-07-31', 'Y-m-d'));
-print(JSON.stringify(res,null,4));
+for (var h in res) {
+ for (var p in res[h]) {
+ if (p == 'IDLE') {
+ print(h + ' ' + Math.floor(res[h][p].total/60000) +') IDLE' );
+ continue;
+ }
+ print(h + ' ' + Math.floor(res[h][p].total/60000) +'m ' + p );
+
+ for (var k in res[h][p].items) {
+
+ print( ' ' + Math.floor(res[h][p].items[k].span/60000) +'m ' + res[h][p].items[k].line );
+
+ }
+
+
+ }
+
+}
+//print(JSON.stringify(res,null,4));
// open file..