Skip to content

Commit

Permalink
allow for --future entries
Browse files Browse the repository at this point in the history
  • Loading branch information
gdraheim committed Mar 21, 2024
1 parent b97cb8c commit 0275317
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zeit2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
ZEIT_SHORT = False
ZEIT_FILENAME = ""
ZEIT_USER_NAME = ""
ZEIT_FUTURE = False

DEFAULT_FILENAME = "~/zeit{YEAR}.txt"

Expand Down Expand Up @@ -97,7 +98,7 @@ def setweek(self, weekdesc: str, weekdays: List[str] = ["so", "mo"], refdate: Op
return False
# sync weekdays to dates
date1 = get_date(match1.group(1), refdate or today)
if date1 > today:
if date1 > today and not ZEIT_FUTURE:
logg.info("going to ignore future week date (%s)", date1)
self.ignore = True
else:
Expand Down Expand Up @@ -520,6 +521,8 @@ def order(name: str) -> str:
help="generate ID column (was used as foreignkey in old odoo)")
cmdline.add_option("-2", "--newformat", action="store_true", default=False,
help="generate Ticket column (can be used to import to jira)")
cmdline.add_option("-8", "--future", action="store_true", default=ZEIT_FUTURE,
help="allow future entries from zeit timesheet")
cmdline.add_option("-a", "--after", metavar="DATE", default=ZEIT_AFTER,
help="only evaluate entrys on and after [first of year]")
cmdline.add_option("-b", "--before", metavar="DATE", default=ZEIT_BEFORE,
Expand Down Expand Up @@ -569,6 +572,7 @@ def order(name: str) -> str:
ZEIT_DESCFILTER = opt.descfilter
ZEIT_FILENAME = opt.filename
ZEIT_SUMMARY = opt.summary
ZEIT_FUTURE = opt.future
ZEIT_AFTER = opt.after
ZEIT_BEFORE = opt.before
if not args or is_dayrange(args[0]):
Expand Down
5 changes: 5 additions & 0 deletions zeit2odoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ZEIT_SUMMARY = "stundenzettel"
ZEIT_PROJSKIP = ""
ZEIT_PROJONLY = ""
ZEIT_FUTURE = False
# [end zeit2json]

PRICES: List[str] = []
Expand Down Expand Up @@ -492,6 +493,7 @@ def run(arg: str) -> None:
zeit_api.ZEIT_BEFORE = DAYS.before.isoformat()
zeit_api.ZEIT_USER_NAME = ZEIT_USER_NAME
zeit_api.ZEIT_SUMMARY = ZEIT_SUMMARY
zeit_api.ZEIT_FUTURE = ZEIT_FUTURE
conf = zeit_api.ZeitConfig(ZEITDATA, username=ZEIT_USER_NAME)
zeit = zeit_api.Zeit(conf)
if CSVDATA:
Expand Down Expand Up @@ -572,6 +574,8 @@ def run(arg: str) -> None:
cmdline.formatter.max_help_position = 30
cmdline.add_option("-v", "--verbose", action="count", default=0, help="more verbose logging")
cmdline.add_option("-^", "--quiet", action="count", default=0, help="less verbose logging")
cmdline.add_option("-8", "--future", action="store_true", default=ZEIT_FUTURE,
help="allow future entries from zeit timesheet")
cmdline.add_option("-a", "--after", metavar="DATE", default=None,
help="only evaluate entrys on and after date")
cmdline.add_option("-b", "--before", metavar="DATE", default=None,
Expand Down Expand Up @@ -646,6 +650,7 @@ def run(arg: str) -> None:
ZEIT_PROJONLY = opt.projonly
ZEIT_PROJSKIP = opt.projskip
ZEIT_SUMMARY = opt.summary
ZEIT_FUTURE = opt.future
PRICES = opt.price
DAYS = dayrange(opt.after, opt.before)
if not args:
Expand Down

0 comments on commit 0275317

Please sign in to comment.