From 706ea1fb358153c8f937fe520a75b5ca7f446f0b Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Sat, 6 Feb 2021 16:50:40 +0100 Subject: [PATCH 1/3] Add schedule for 2.2, some online links are unknown & are Zoom until the professors say where they happen --- files/config.json | 2 +- files/schedules/22.json | 82 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 files/schedules/22.json diff --git a/files/config.json b/files/config.json index 670b336..fabdd7d 100644 --- a/files/config.json +++ b/files/config.json @@ -1 +1 @@ -{"semester": "1", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 22} \ No newline at end of file +{"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 22} \ No newline at end of file diff --git a/files/schedules/22.json b/files/schedules/22.json new file mode 100644 index 0000000..d9b3a76 --- /dev/null +++ b/files/schedules/22.json @@ -0,0 +1,82 @@ +[ + { + "course": "Computerarchitectuur", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/228912/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "Zoom", + "time": ["maandag", 1000, 1300] + }, + { + "online": "Zoom", + "time": ["dinsdag", 830, 930] + }, + { + "online": "Zoom", + "time": ["donderdag", 1430, 1700] + } + ] + }, + { + "course": "Multimedia", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/236949/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "Zoom", + "time": ["maandag", 1430, 1730] + }, + { + "campus": "Sterre", + "building": "S9", + "room": "A3", + "time": ["woensdag", 1130, 1330] + } + ] + }, + { + "course": "Wetenschappelijk Rekenen", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/236404/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "Zoom", + "time": ["dinsdag", 1130, 1300] + }, + { + "online": "Zoom", + "time": ["woensdag", 1500, 1800] + }, + { + "online": "Zoom", + "time": ["donderdag", 830, 1000] + } + ] + }, + { + "course": "Software Engineering Lab 1", + "slots": [ + { + "online": "Zoom", + "time": ["dinsdag", 1430, 1700] + }, + { + "online": "Zoom", + "time": ["vrijdag", 830, 1130] + } + ] + }, + { + "course": "Webdevelopment", + "slots": [ + { + "campus": "Sterre", + "building": "S9", + "room": "A3", + "time": ["woensdag", 900, 1100] + }, + { + "online": "Zoom", + "time": ["donderdag", 1000, 1300] + } + ] + } +] \ No newline at end of file From 2593c3ba0d5dcea3fedb357b507de6abffe5c60c Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Sat, 6 Feb 2021 17:01:43 +0100 Subject: [PATCH 2/3] Re-enable les, fix schedule --- cogs/school.py | 41 +++++++++++------------------------------ files/config.json | 2 +- files/schedules/22.json | 20 ++++++++++---------- functions/les.py | 11 +++++------ 4 files changed, 27 insertions(+), 47 deletions(-) diff --git a/cogs/school.py b/cogs/school.py index a12a919..52fd18d 100644 --- a/cogs/school.py +++ b/cogs/school.py @@ -43,41 +43,22 @@ class School(commands.Cog): @commands.check(checks.allowedChannels) @help.Category(category=Category.School) async def les(self, ctx, *day): - embed = discord.Embed(colour=discord.Colour.blue()) + parsed = les.parseArgs(day) - # These are hardcoded because they don't change & don't matter anymore in a month - embed.set_author(name="Examenrooster 2de Bachelor") + # Invalid arguments + if not parsed[0]: + return await ctx.send(parsed[1]) - embed.add_field(name="Algoritmen en Datastructuren 2", - value="Woensdag 06/01/2021\n13:00 - 16:00\nFlanders Expo, Hal 4D", inline=False) - embed.add_field(name="Functioneel Programmeren", - value="Dinsdag 12/01/2021\n13:00 - 16:00\nFlanders Expo, Hal 5C", inline=False) - embed.add_field(name="Systeemprogrammeren", - value="Maandag 18/01/2021\n08:30 - 11:30\nOnline, schriftelijk", inline=False) - embed.add_field(name="Communicatienetwerken", - value="Vrijdag 22/01/2021\n13:00 - 16:00\nFlanders Expo Hal 4A", inline=False) - embed.add_field(name="Statistiek en Probabiliteit", - value="Vrijdag 29/01/2021\n08:30 - 11:30\nCampus Ardoyen Locus, PC Resto Locus", inline=False) + day, dayDatetime, semester, year = parsed[1:] + + # Customize the user's schedule + schedule = self.customizeSchedule(ctx, year, semester) + + # Create the embed + embed = les.createEmbed(day, dayDatetime, semester, year, schedule) await ctx.send(embed=embed) - # Les code - # parsed = les.parseArgs(day) - # - # # Invalid arguments - # if not parsed[0]: - # return await ctx.send(parsed[1]) - # - # day, dayDatetime, semester, year = parsed[1:] - # - # # Customize the user's schedule - # schedule = self.customizeSchedule(ctx, year, semester) - # - # # Create the embed - # embed = les.createEmbed(day, dayDatetime, semester, year, schedule) - # - # await ctx.send(embed=embed) - # Add all the user's courses def customizeSchedule(self, ctx, year, semester): schedule = les.getSchedule(semester, year) diff --git a/files/config.json b/files/config.json index fabdd7d..dd9aec4 100644 --- a/files/config.json +++ b/files/config.json @@ -1 +1 @@ -{"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 22} \ No newline at end of file +{"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 24} \ No newline at end of file diff --git a/files/schedules/22.json b/files/schedules/22.json index d9b3a76..b9c2c12 100644 --- a/files/schedules/22.json +++ b/files/schedules/22.json @@ -4,15 +4,15 @@ "zoom": "https://ufora.ugent.be/d2l/ext/rp/228912/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "slots": [ { - "online": "Zoom", + "online": "ZOOM", "time": ["maandag", 1000, 1300] }, { - "online": "Zoom", + "online": "ZOOM", "time": ["dinsdag", 830, 930] }, { - "online": "Zoom", + "online": "ZOOM", "time": ["donderdag", 1430, 1700] } ] @@ -22,7 +22,7 @@ "zoom": "https://ufora.ugent.be/d2l/ext/rp/236949/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "slots": [ { - "online": "Zoom", + "online": "ZOOM", "time": ["maandag", 1430, 1730] }, { @@ -38,15 +38,15 @@ "zoom": "https://ufora.ugent.be/d2l/ext/rp/236404/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "slots": [ { - "online": "Zoom", + "online": "ZOOM", "time": ["dinsdag", 1130, 1300] }, { - "online": "Zoom", + "online": "ZOOM", "time": ["woensdag", 1500, 1800] }, { - "online": "Zoom", + "online": "ZOOM", "time": ["donderdag", 830, 1000] } ] @@ -55,11 +55,11 @@ "course": "Software Engineering Lab 1", "slots": [ { - "online": "Zoom", + "online": "ZOOM", "time": ["dinsdag", 1430, 1700] }, { - "online": "Zoom", + "online": "ZOOM", "time": ["vrijdag", 830, 1130] } ] @@ -74,7 +74,7 @@ "time": ["woensdag", 900, 1100] }, { - "online": "Zoom", + "online": "ZOOM", "time": ["donderdag", 1000, 1300] } ] diff --git a/functions/les.py b/functions/les.py index c8b4229..9b6b558 100644 --- a/functions/les.py +++ b/functions/les.py @@ -21,7 +21,7 @@ def createCourseString(courses): def createEmbed(day, dayDatetime, semester, year, schedule): # Create a date object to check the current week - startDate = 1600041600 + startDate = 1612224000 currentTime = dayDatetime.timestamp() week = clamp(timeFormatters.timeIn(currentTime - startDate, "weeks")[0], 1, 13) @@ -47,12 +47,11 @@ def createEmbed(day, dayDatetime, semester, year, schedule): if extras: embed.add_field(name="Extra", value="\n".join(getExtras(extra) for extra in extras), inline=False) - # TODO uncomment this when covid rules slow down # Add online links - temporarily removed because everything is online right now - # if online: - # uniqueLinks: dict = getUniqueLinks(online) - # embed.add_field(name="Online Links", value="\n".join( - # sorted(getLinks(onlineClass, links) for onlineClass, links in uniqueLinks.items()))) + if online: + uniqueLinks: dict = getUniqueLinks(online) + embed.add_field(name="Online Links", value="\n".join( + sorted(getLinks(onlineClass, links) for onlineClass, links in uniqueLinks.items()))) embed.set_footer(text="Semester {} | Lesweek {}".format(semester, round(week))) return embed From e611cc1285517d1e6a397270396c8cc21cd22c96 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Sat, 6 Feb 2021 17:04:32 +0100 Subject: [PATCH 3/3] Add in placeholder zoom links for classes where online link isn't known yet --- files/schedules/22.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/schedules/22.json b/files/schedules/22.json index b9c2c12..5ef090a 100644 --- a/files/schedules/22.json +++ b/files/schedules/22.json @@ -53,6 +53,7 @@ }, { "course": "Software Engineering Lab 1", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/235800/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "slots": [ { "online": "ZOOM", @@ -66,6 +67,7 @@ }, { "course": "Webdevelopment", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/223449/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "slots": [ { "campus": "Sterre",