Skip to content

Commit

Permalink
add new catalogue information to coursemax
Browse files Browse the repository at this point in the history
  • Loading branch information
Highfire1 committed Jun 28, 2024
1 parent 087c63c commit 30269ff
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def _generateCourseIndexes(self) -> None:
This takes quite a bit of effort to build...
"""

course_summary_possibly_old = None
statement = select(CourseSummaryDB).where(
CourseSummaryDB.subject == subject,
CourseSummaryDB.course_code == course_code
Expand All @@ -384,6 +385,8 @@ def _generateCourseIndexes(self) -> None:
c.hours_lecture = r.hours_lecture
c.hours_seminar = r.hours_seminar
c.hours_lab = r.hours_lab

course_summary_possibly_old = r

# CoursePage
# We replace the attributes from CourseSummary because
Expand All @@ -394,9 +397,7 @@ def _generateCourseIndexes(self) -> None:
).limit(1)
results = session.exec(statement)
r = session.exec(statement).first()
if r == None:
c.active = False
else:
if r != None:
c.active = True
c.title = r.title
c.description = r.description
Expand All @@ -413,6 +414,14 @@ def _generateCourseIndexes(self) -> None:
# c.university_transferrable = r.university_transferrable
c.offered_online = r.offered_online
c.preparatory_course = r.preparatory_course
else:
c.active = False
if course_summary_possibly_old != None:
r = course_summary_possibly_old
if r.description != None and r.desc_last_updated != None:
c.description = r.description + "\n\n" + r.desc_last_updated
c.desc_replacement_course = r.desc_replacement_course
c.desc_prerequisite = r.desc_requisites


statement = select(CourseAttributeDB).where(
Expand Down Expand Up @@ -457,7 +466,7 @@ def _generateCourseIndexes(self) -> None:
if r.source_title != None and c.title == None:
c.title = r.source_title
if r.source_credits != None and c.credits == None:
c.credits = r.source_credits
c.credits = r.source_credits

# generate some aggregate values
statement = select(SectionDB).where(
Expand Down

0 comments on commit 30269ff

Please sign in to comment.