summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guégan <manzerbredes@mailbox.org>2025-07-25 13:12:06 +0200
committerLoïc Guégan <manzerbredes@mailbox.org>2025-07-25 13:12:06 +0200
commitcb7e02e1b061ddfcd34cbe3c38951bba0944030e (patch)
treeee2e89d90b1cfbb7c79d3a9a053e8fdee831bfa7
parentb8c9f220f66a97fa49c7952fbff45340dd7f0440 (diff)
Minor changes
-rw-r--r--infos.yaml1
-rwxr-xr-xmain.py6
2 files changed, 5 insertions, 2 deletions
diff --git a/infos.yaml b/infos.yaml
index bc7aab1..b9d53d8 100644
--- a/infos.yaml
+++ b/infos.yaml
@@ -7,6 +7,7 @@ semester:
output:
date_format: "%b %d"
format: "text" # Or html/json/csv/latex/mediawiki
+ week_drift: 0 # Add constant offset to week numbers
tables:
calendar:
hidden: no
diff --git a/main.py b/main.py
index d56cf99..a4912ec 100755
--- a/main.py
+++ b/main.py
@@ -17,6 +17,8 @@ def getnextdayn(d,n):
return (d+timedelta(days=n))
def formatday(d):
return d.strftime(i["output"]["date_format"])
+def getweek(d):
+ return d.isocalendar().week + i["output"]["week_drift"]
def getassign(d):
val=""
for a in i["assignments"]:
@@ -57,7 +59,7 @@ if not i["output"]["tables"]["calendar"]["hidden"]:
sstart=parse_date(i["semester"]["start"])
send=parse_date(i["semester"]["end"])
d=sstart
- w=d.isocalendar().week
+ w=getweek(d)
o=i["output"]["tables"]["calendar"]
if o["semester_dates_as_events"]:
i["events"]["sstart_098888986"]={} # Add random numbers to avoid clash with users entries
@@ -126,6 +128,6 @@ if not i["output"]["tables"]["deadlines"]["hidden"]:
msg=i["output"]["tables"]["deadlines"]["msg_handout"].format(a)
else:
msg=i["output"]["tables"]["deadlines"]["msg_deadline"].format(a)
- t.add_row([d.isocalendar().week,formatday(d),msg])
+ t.add_row([getweek(d),formatday(d),msg])
t.align["Assignment"] = "l"
print(t.get_formatted_string(i["output"]["format"]))