changeset 192:9bb175cfaca3

Use unix_week conversion function for zeiterfassung
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 17 Jan 2013 11:42:12 +0100
parents 64624032611d
children e7466f3210c6
files getan/contrib/zeiterfassung.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/getan/contrib/zeiterfassung.py	Thu Jan 17 11:41:36 2013 +0100
+++ b/getan/contrib/zeiterfassung.py	Thu Jan 17 11:42:12 2013 +0100
@@ -195,16 +195,21 @@
             usage()
         elif opt in ("--list", "-l"):
             list_projects = True
-        elif opt in ("--week", "-w"):
-            week = val
-        elif opt in ("--lastweek", "-c") and not week:
-            lastweek = (datetime.now()-timedelta(7)).isocalendar()[1]
-            week = "%02d" % lastweek
         elif opt in ("--year", "-y"):
             year = val
+        elif opt in ("--week", "-w"):
+            week = int(val)
+        elif opt in ("--lastweek", "-c") and not week:
+            week = (datetime.now()-timedelta(7)).isocalendar()[1]
         elif opt in ("--empty", "-m"):
             empty_proj = True
 
+    if not week is None:
+        wyear = None
+        if not year is None:
+            wyear = int(year)
+        week = "%02d" % unix_week(week, wyear)
+
     if not user:
         user = os.getenv("USER")
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)