Re-enable les, fix schedule

pull/35/head
Stijn De Clercq 2021-02-06 17:01:43 +01:00
parent 706ea1fb35
commit 2593c3ba0d
4 changed files with 27 additions and 47 deletions

View File

@ -43,41 +43,22 @@ class School(commands.Cog):
@commands.check(checks.allowedChannels) @commands.check(checks.allowedChannels)
@help.Category(category=Category.School) @help.Category(category=Category.School)
async def les(self, ctx, *day): 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 # Invalid arguments
embed.set_author(name="Examenrooster 2de Bachelor") if not parsed[0]:
return await ctx.send(parsed[1])
embed.add_field(name="Algoritmen en Datastructuren 2", day, dayDatetime, semester, year = parsed[1:]
value="Woensdag 06/01/2021\n13:00 - 16:00\nFlanders Expo, Hal 4D", inline=False)
embed.add_field(name="Functioneel Programmeren", # Customize the user's schedule
value="Dinsdag 12/01/2021\n13:00 - 16:00\nFlanders Expo, Hal 5C", inline=False) schedule = self.customizeSchedule(ctx, year, semester)
embed.add_field(name="Systeemprogrammeren",
value="Maandag 18/01/2021\n08:30 - 11:30\nOnline, schriftelijk", inline=False) # Create the embed
embed.add_field(name="Communicatienetwerken", embed = les.createEmbed(day, dayDatetime, semester, year, schedule)
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)
await ctx.send(embed=embed) 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 # Add all the user's courses
def customizeSchedule(self, ctx, year, semester): def customizeSchedule(self, ctx, year, semester):
schedule = les.getSchedule(semester, year) schedule = les.getSchedule(semester, year)

View File

@ -1 +1 @@
{"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 22} {"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 24}

View File

@ -4,15 +4,15 @@
"zoom": "https://ufora.ugent.be/d2l/ext/rp/228912/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "zoom": "https://ufora.ugent.be/d2l/ext/rp/228912/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
"slots": [ "slots": [
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["maandag", 1000, 1300] "time": ["maandag", 1000, 1300]
}, },
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["dinsdag", 830, 930] "time": ["dinsdag", 830, 930]
}, },
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["donderdag", 1430, 1700] "time": ["donderdag", 1430, 1700]
} }
] ]
@ -22,7 +22,7 @@
"zoom": "https://ufora.ugent.be/d2l/ext/rp/236949/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "zoom": "https://ufora.ugent.be/d2l/ext/rp/236949/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
"slots": [ "slots": [
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["maandag", 1430, 1730] "time": ["maandag", 1430, 1730]
}, },
{ {
@ -38,15 +38,15 @@
"zoom": "https://ufora.ugent.be/d2l/ext/rp/236404/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", "zoom": "https://ufora.ugent.be/d2l/ext/rp/236404/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
"slots": [ "slots": [
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["dinsdag", 1130, 1300] "time": ["dinsdag", 1130, 1300]
}, },
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["woensdag", 1500, 1800] "time": ["woensdag", 1500, 1800]
}, },
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["donderdag", 830, 1000] "time": ["donderdag", 830, 1000]
} }
] ]
@ -55,11 +55,11 @@
"course": "Software Engineering Lab 1", "course": "Software Engineering Lab 1",
"slots": [ "slots": [
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["dinsdag", 1430, 1700] "time": ["dinsdag", 1430, 1700]
}, },
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["vrijdag", 830, 1130] "time": ["vrijdag", 830, 1130]
} }
] ]
@ -74,7 +74,7 @@
"time": ["woensdag", 900, 1100] "time": ["woensdag", 900, 1100]
}, },
{ {
"online": "Zoom", "online": "ZOOM",
"time": ["donderdag", 1000, 1300] "time": ["donderdag", 1000, 1300]
} }
] ]

View File

@ -21,7 +21,7 @@ def createCourseString(courses):
def createEmbed(day, dayDatetime, semester, year, schedule): def createEmbed(day, dayDatetime, semester, year, schedule):
# Create a date object to check the current week # Create a date object to check the current week
startDate = 1600041600 startDate = 1612224000
currentTime = dayDatetime.timestamp() currentTime = dayDatetime.timestamp()
week = clamp(timeFormatters.timeIn(currentTime - startDate, "weeks")[0], 1, 13) week = clamp(timeFormatters.timeIn(currentTime - startDate, "weeks")[0], 1, 13)
@ -47,12 +47,11 @@ def createEmbed(day, dayDatetime, semester, year, schedule):
if extras: if extras:
embed.add_field(name="Extra", value="\n".join(getExtras(extra) for extra in extras), inline=False) 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 # Add online links - temporarily removed because everything is online right now
# if online: if online:
# uniqueLinks: dict = getUniqueLinks(online) uniqueLinks: dict = getUniqueLinks(online)
# embed.add_field(name="Online Links", value="\n".join( embed.add_field(name="Online Links", value="\n".join(
# sorted(getLinks(onlineClass, links) for onlineClass, links in uniqueLinks.items()))) sorted(getLinks(onlineClass, links) for onlineClass, links in uniqueLinks.items())))
embed.set_footer(text="Semester {} | Lesweek {}".format(semester, round(week))) embed.set_footer(text="Semester {} | Lesweek {}".format(semester, round(week)))
return embed return embed