diff contrib/zeiterfassung @ 9:4e8f5545256d

* Applied and completed Stephan Holl's zeiterfassung.bessere-lesbarkeit.patch * fixed small issue with --project= parameter.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 03 Aug 2008 15:52:21 +0200
parents 20414d892f04
children 4f782a05b4dc
line wrap: on
line diff
--- a/contrib/zeiterfassung	Fri Aug 01 18:13:31 2008 +0200
+++ b/contrib/zeiterfassung	Sun Aug 03 15:52:21 2008 +0200
@@ -28,9 +28,9 @@
 
 USAGE = '''usage: %s <options>
     with <options>
-    [--user=|-u <user>]        : Name of user,   default: $USER
-    [--database=|-d <database>]: getan database, default: time.db
-    [--project|-p]             : Key of output project, default: all
+    [--user=|-u <user>]        : Name of user,          default: $USER
+    [--database=|-d <database>]: getan database,        default: time.db
+    [--project=|-p <key>]      : Key of output project, default: all
     [--list|-l]                : list all projects
     [--help|-h]                : This text'''
 
@@ -39,11 +39,11 @@
 '''
 
 PROJECT_ID_BY_KEY = '''
-SELECT id FROM projects where key = :key
+SELECT id, description FROM projects where key = :key
 '''
 
 ALL_PROJECT_IDS = '''
-SELECT id, key FROM projects;
+SELECT id, key, description FROM projects
 '''
 
 ENTRIES = '''
@@ -103,7 +103,7 @@
     opts, args = getopt.getopt(
         sys.argv[1:],
         'd:u:p:hl',
-        ['database=', 'user=', 'project', 'help', 'list'])
+        ['database=', 'user=', 'project=', 'help', 'list'])
 
     for opt, val in opts:
         if opt in ("--database", "-d"):
@@ -142,13 +142,13 @@
                     row = cur.fetchone()
                     if row is None:
                         raise TermError("There is no project with key '%s'" % project)
-                    project_ids = [[row[0], project]]
+                    project_ids = [[row[0], project, row[1]]]
                 else:
                     cur.execute(ALL_PROJECT_IDS);
                     project_ids = cur.fetchall()
 
-                for project_id, project in project_ids:
-                    print "# project: %s" % project
+                for project_id, project, proj_desc in project_ids:
+                    print "# project: %s (%s)" % (project, proj_desc)
                     cur.execute(ENTRIES, {'project_id': project_id})
                     total = 0
                     while True:
@@ -171,7 +171,7 @@
                             user,
                             workpackage,
                             c)
-                    print "# total: %sh" % human_time(total)
+                    print "# total: %sh\n\n" % human_time(total)
         finally:
             tolerantClose(cur)
             tolerantClose(con)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)