Skip to content

Commit

Permalink
Merge pull request #52 from nattvara/fix-no-course-issue
Browse files Browse the repository at this point in the history
Fix issue where untagged lectures couldn't be found
  • Loading branch information
nattvara authored Apr 23, 2023
2 parents 0144b51 + 1c35f9e commit 19d0031
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions api/routers/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class CourseOutputModel(BaseModel):

@router.get('/courses/{course_code}', dependencies=[Depends(get_db)])
def get_course(course_code: str) -> CourseOutputModel:
if course_code == 'no_course':
return {
'course_code': 'no_course',
'display_name': 'Untagged Lectures',
}

course = find_course_code(course_code)
if course is None:
raise HTTPException(status_code=404)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ export default function CourseContent(props: CourseContentProps) {
{!isLoadingCourseInfo && (
<>
<Row>
<Title level={2} className={styles.course_code}>
{course.course_code}
</Title>
{course.course_code !== 'no_course' && (
<Title level={2} className={styles.course_code}>
{course.course_code}
</Title>
)}
</Row>
<Row>
<Title level={3} className={styles.display_name}>
Expand Down

0 comments on commit 19d0031

Please sign in to comment.