Mercurial > getan
changeset 60:9df5d62e6f7e
add switch to show also empty projects
by default only projects with total_proj time > 0 are displayed
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 03 May 2011 14:43:58 +0200 (2011-05-03) |
parents | 58bfac26a9ff |
children | 4b58763e75c1 |
files | contrib/zeiterfassung |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/zeiterfassung Tue May 03 14:37:23 2011 +0200 +++ b/contrib/zeiterfassung Tue May 03 14:43:58 2011 +0200 @@ -36,7 +36,8 @@ [--week=]|-w <week>] : week of year [--year=]|-y <year>] : year [--list|-l] : list all projects - [--help|-h] : This text''' + [--help|-h] : This text + [--emtpy|-m] : show empty projects''' LIST_PROJECTS = ''' SELECT key, description, active FROM projects @@ -147,11 +148,12 @@ encoding = None week = None year = None + empty_proj = False opts, args = getopt.getopt( sys.argv[1:], - 'd:u:p:e:hl:w:y:', - ['database=', 'user=', 'project=', 'encoding=', 'help', 'list', 'week=', 'year=']) + 'd:u:p:e:hl:w:y:m', + ['database=', 'user=', 'project=', 'encoding=', 'help', 'list', 'week=', 'year=', 'empty']) for opt, val in opts: if opt in ("--database", "-d"): @@ -170,6 +172,8 @@ week = val elif opt in ("--year", "-y"): year = val + elif opt in ("--empty", "-m"): + empty_proj = True if not user: user = os.getenv("USER") @@ -213,7 +217,6 @@ total = 0 for project_id, project, proj_desc in project_ids: - print "# project: %s (%s)" % (project, proj_desc) if not week is None: cur.execute(WEEK_ENTRIES, {'project_id': project_id, 'week': week, 'year' : proj_year}) elif not year: @@ -243,7 +246,9 @@ workpackage, c) total += total_proj - print "# total: %sh\n\n" % human_time(total_proj) + if empty_proj or total_proj > 0: + print "# project: %s (%s)" % (project, proj_desc) + print "# total: %sh\n\n" % human_time(total_proj) print "# total all projects: %sh\n\n" % human_time(total) finally: tolerantClose(cur)