From f5e62a0fb99555bf18c7bc81875ba2fe0c785ed8 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Sun, 26 Dec 2021 00:30:14 +0100 Subject: [PATCH] Empty deadlines, fix error, add easter egg --- data/embeds/deadlines.py | 14 ++++++++------ files/deadlines.json | 35 ++--------------------------------- 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/data/embeds/deadlines.py b/data/embeds/deadlines.py index 8e7a3b6..4df7d04 100644 --- a/data/embeds/deadlines.py +++ b/data/embeds/deadlines.py @@ -47,10 +47,6 @@ class Deadlines: now = time.time() - if not self.data: - embed.description = "Er staan geen deadlines gepland." - return embed - courses: Dict for year, courses in sorted(self.data.items(), key=lambda x: x[0]): content = [] @@ -61,8 +57,14 @@ class Deadlines: content.append(Deadline(course, deadline, t, t < now)) content.sort(key=lambda x: x.t) - content = map(lambda x: str(x), content) + content = list(map(lambda x: str(x), content)) - embed.add_field(name=get_edu_year(int(year)), value="\n".join(content), inline=False) + if content: + embed.add_field(name=get_edu_year(int(year)), value="\n".join(content), inline=False) + + # No deadlines planned + if not embed.fields: + embed.description = "Er staan geen deadlines gepland." + embed.set_image(url="https://c.tenor.com/RUzJ3lDGQUsAAAAC/iron-man-you-can-rest-now.gif") return embed diff --git a/files/deadlines.json b/files/deadlines.json index a709f69..b9dc61f 100644 --- a/files/deadlines.json +++ b/files/deadlines.json @@ -1,35 +1,4 @@ { - "2": { - "StatProb": { - "Project": 1639090740 - }, - "AD2": { - "Project": 1638738000 - }, - "FuncProg": { - "Project 3": 1640104200 - } - }, - "3": { - "AD3": { - "Project (code)": 1638967062, - "Project (verslag)": 1639571862 - }, - "AI": { - "Presentatie project": 1639870920, - "Verslag": 1640386799 - }, - "BestSys": { - "Linux pract 2": 1638402120, - "Linux pract 3": 1639006920 - }, - "Modsim": { - "Project": 1640386799 - }, - "Telecom": { - "Keuze artikel": 1638745140, - "Presentaties 1": 1639990800, - "Presentaties 2": 1640088000 - } - } + "2": {}, + "3": {} }