Add more ids of courses

pull/177/head
Stijn De Clercq 2023-09-24 15:40:27 +02:00
parent a54fb985e7
commit ae28f3a286
1 changed files with 14 additions and 15 deletions

View File

@ -16,30 +16,29 @@ async def main():
await session.execute(delete_stmt) await session.execute(delete_stmt)
await session.commit() await session.commit()
# Enable announcements for current courses # Fix IDs of compulsory courses and enable announcements
select_stmt = select(UforaCourse).where(UforaCourse.compulsory & (UforaCourse.year == 5)) select_stmt = select(UforaCourse).where(UforaCourse.code == "C004074")
second_master_courses: list[UforaCourse] = list((await session.execute(select_stmt)).scalars().all()) bds: UforaCourse = (await session.execute(select_stmt)).scalar_one()
bds.course_id = 828305
bds.log_announcements = True
session.add(bds)
for course in second_master_courses: select_stmt = select(UforaCourse).where(UforaCourse.code == "C004073")
course.log_announcements = True cg: UforaCourse = (await session.execute(select_stmt)).scalar_one()
session.add(course) cg.course_id = 828293
cg.log_announcements = True
session.add(bds)
select_stmt = select(UforaCourse).where(UforaCourse.code == "C003711")
comp_bio: UforaCourse = (await session.execute(select_stmt)).scalar_one()
comp_bio.log_announcements = True
session.add(comp_bio)
await session.commit()
# Fix IDs of courses
select_stmt = select(UforaCourse).where(UforaCourse.code == "C004075") select_stmt = select(UforaCourse).where(UforaCourse.code == "C004075")
stage: UforaCourse = (await session.execute(select_stmt)).scalar_one() stage: UforaCourse = (await session.execute(select_stmt)).scalar_one()
stage.course_id = 857878 stage.course_id = 857878
stage.log_announcements = True
session.add(stage) session.add(stage)
select_stmt = select(UforaCourse).where(UforaCourse.code == "C002309A") select_stmt = select(UforaCourse).where(UforaCourse.code == "C002309")
thesis: UforaCourse = (await session.execute(select_stmt)).scalar_one() thesis: UforaCourse = (await session.execute(select_stmt)).scalar_one()
thesis.course_id = 828446 thesis.course_id = 828446
thesis.log_announcements = True
session.add(thesis) session.add(thesis)
await session.commit() await session.commit()