Merge pull request #35 from stijndcl/update_schedules

Add schedule 2.2, re-enable Les
pull/36/head
Stijn De Clercq 2021-02-06 17:19:10 +01:00 committed by GitHub
commit d13a5f77d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 37 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": "1", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 22} {"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 24}

View File

@ -0,0 +1,84 @@
[
{
"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",
"zoom": "https://ufora.ugent.be/d2l/ext/rp/235800/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
"slots": [
{
"online": "ZOOM",
"time": ["dinsdag", 1430, 1700]
},
{
"online": "ZOOM",
"time": ["vrijdag", 830, 1130]
}
]
},
{
"course": "Webdevelopment",
"zoom": "https://ufora.ugent.be/d2l/ext/rp/223449/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
"slots": [
{
"campus": "Sterre",
"building": "S9",
"room": "A3",
"time": ["woensdag", 900, 1100]
},
{
"online": "ZOOM",
"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