Arreglados bugs de mostrado
authorDaniel Garcia Moreno <dgarcia@emergya.es>
Wed, 24 Sep 2008 07:01:50 +0000 (09:01 +0200)
committerDaniel Garcia Moreno <dgarcia@emergya.es>
Wed, 24 Sep 2008 07:01:50 +0000 (09:01 +0200)
ahora es más eficiente

ttt.py

diff --git a/ttt.py b/ttt.py
index f62178b..e437837 100755 (executable)
--- a/ttt.py
+++ b/ttt.py
@@ -38,6 +38,8 @@ def track(task, project='', ticket=0):
                  'project':project,
                  'ticket':ticket}
             sys.stdout.write(cadena)
                  'project':project,
                  'ticket':ticket}
             sys.stdout.write(cadena)
+            sys.stdout.flush()
+            time.sleep(0.5)
     except:
         print '\n', 'Finalizando'
         end = datetime.datetime.now()
     except:
         print '\n', 'Finalizando'
         end = datetime.datetime.now()
@@ -52,7 +54,7 @@ def show(trackers):
     total = 0
     for i in trackers:
         diff = i.end - i.start
     total = 0
     for i in trackers:
         diff = i.end - i.start
-        total += diff
+        total += diff.seconds
         time_passed = parse_time(diff.seconds)
 
         key = (i.task, i.project)
         time_passed = parse_time(diff.seconds)
 
         key = (i.task, i.project)
@@ -62,8 +64,8 @@ def show(trackers):
         else:
             grouped[key] = diff.seconds
         
         else:
             grouped[key] = diff.seconds
         
-        to_show = '%-20s | %-40s | #%-6d | %s | %s | %s'
-        print to_show % (i.project, i.task, i.ticket, i.start, i.end,
+        to_show = '%-20s | %-20s | #%-6d | %s | %s'
+        print to_show % (i.project, i.task, i.ticket, i.start.ctime(),
                                                             time_passed)
     
     print ''
                                                             time_passed)
     
     print ''
@@ -86,7 +88,7 @@ def show_project(project):
     for i in project_trackers:
         sum += (i.end - i.start).seconds
 
     for i in project_trackers:
         sum += (i.end - i.start).seconds
 
-    print 'Tiempo para %s: %s' % (project, parse_time(sum))
+    print 'Tiempo para "%s": %s' % (project, parse_time(sum))
 
 def show_sem():
     show_today(7)
 
 def show_sem():
     show_today(7)
@@ -108,7 +110,8 @@ def show_grouped(trackers):
             projects[i.project] = diff
 
     for k,v in projects.items():
             projects[i.project] = diff
 
     for k,v in projects.items():
-        print 'Tiempo para %-50s: %s' % (k, parse_time(v))
+        p = '"' + k + '":'
+        print 'Tiempo para %-20s %s' % (p, parse_time(v))
 
     print '\nTotal para hoy: %s' % parse_time(total)
 
 
     print '\nTotal para hoy: %s' % parse_time(total)