Tools: Weekly report script option for weeks further in the past

Adds a `--weeks-ago` option to be able to control which week the report
should be made for. In practice people sometimes need to create reports
for a few weeks ago or for the current week.
This commit is contained in:
Julian Eisel 2024-01-08 12:29:03 +01:00
parent 2e2b5dcd52
commit 2db0dd6542
1 changed files with 9 additions and 1 deletions

View File

@ -36,6 +36,14 @@ def argparse_create():
required=False,
help="")
parser.add_argument(
"--weeks-ago",
dest="weeks_ago",
type=int,
default=1,
help="Determine which week the report should be generated for. 0 means the current week. "
"The default is 1, to create a report for the previous week.")
parser.add_argument(
"-v",
"--verbose",
@ -247,7 +255,7 @@ def main() -> None:
return
# end_date = datetime.datetime(2020, 3, 14)
end_date = datetime.datetime.now()
end_date = datetime.datetime.now() - datetime.timedelta(weeks=(args.weeks_ago - 1))
weekday = end_date.weekday()
# Assuming I am lazy and making this at last moment or even later in worst case