Load year from settings

pull/119/head
stijndcl 2022-07-15 23:14:56 +02:00
parent 5b47397f29
commit 3d0f771f94
3 changed files with 14 additions and 3 deletions

View File

@ -6,6 +6,7 @@ from discord.ext import commands
from database.crud import ufora_courses
from didier import Didier
from didier.data import constants
class School(commands.Cog):
@ -70,10 +71,9 @@ class School(commands.Cog):
if ufora_course is None:
return await ctx.reply(f"Geen vak gevonden voor ``{course}``", ephemeral=True)
# TODO load from config
year = 2018 + 3
return await ctx.reply(
f"https://studiekiezer.ugent.be/studiefiche/nl/{ufora_course.code}/{year}", mention_author=False
f"https://studiekiezer.ugent.be/studiefiche/nl/{ufora_course.code}/{constants.CURRENT_YEAR}",
mention_author=False,
)
@study_guide.autocomplete("course")

View File

@ -1 +1,10 @@
# The year in which we were in 1Ba
import settings
FIRST_YEAR = 2019
# Year to use when adding the current year of our education
# to find the academic year
OFFSET_FIRST_YEAR = FIRST_YEAR - 1
# The current academic year
CURRENT_YEAR = OFFSET_FIRST_YEAR + settings.YEAR
PREFIXES = ["didier", "big d"]

View File

@ -29,6 +29,8 @@ __all__ = [
"""General config"""
SANDBOX: bool = env.bool("SANDBOX", True)
LOGFILE: str = env.str("LOGFILE", "didier.log")
SEMESTER: int = env.int("SEMESTER", 2)
YEAR: int = env.int("YEAR", 3)
"""Database"""
DB_NAME: str = env.str("DB_NAME", "didier")