README.txt
[gitlive] / GitLogParser.js
index bb2b30e..96bc48e 100644 (file)
@@ -29,6 +29,9 @@ GitLogParser = {
                 lines.push( this.parseLine(xl[ii] + ' ' + xl[ii+1])); 
                 if (p > 0) {
                     lines[p-1].span = lines[p].start - lines[p-1].start; // should be seconds..?
+                    lines[p-1].spanMin = lines[p-1].span/60000;
+                    
+                    
                 }
             
             }
@@ -42,10 +45,12 @@ GitLogParser = {
         for (var i = 0; i < lines.length; i++) {
             var line = lines[i];
             var hour = line.start.format('H');
-            var project = line.project;
-            
             
+            if (line.project == 'IDLE' && line.spanMin >= 5 ) {
+                line.project = 'LONGIDLE';
+            }
             
+            var project = line.project;
             hours[hour] = (typeof(hours[hour]) == 'undefined') ? {} : hours[hour];
             hours[hour][project] = (typeof(hours[hour][project]) == 'undefined') ? 
                     { total : 0, items : [] } 
@@ -157,12 +162,11 @@ var res = GitLogParser.parse(xDate.Date.parseDate(Seed.argv[2], 'Y-m-d'));
 var totals = { work : 0 , idle: 0}
 for (var h in res) {
     for (var p in res[h]) {
-        if (p == 'IDLE') {
+        if (p == 'LONGIDLE') {
             var idletime = Math.floor(res[h][p].total/60000) ;
             print(h + ' ' + Math.floor(res[h][p].total/60000) +'m IDLE' );
-            if (idletime > 5) {
-                totals.idle += idletime;
-            }
+            totals.idle += idletime;
+            
              
             continue;
         }
@@ -178,7 +182,7 @@ for (var h in res) {
     }
     
 }
-print("\nIDLE : " +(totals.idle/60).toFixed(2) +"h" );
+print("\nLONGIDLE : " +(totals.idle/60).toFixed(2) +"h" );
 print("Worked: " + (totals.work/60).toFixed(2) +"h\n" );