Skip to content

Commit

Permalink
Fixed "Error loading grades information" with empty course code (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacNguyen authored Dec 10, 2024
1 parent 7bee1c2 commit 34a4088
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export default function CourseRenderPane(props: { id?: number }) {
department: formData.deptValue,
ge: formData.ge as GE,
instructor: formData.instructor,
sectionCode: formData.sectionCode,
};

try {
Expand Down
7 changes: 5 additions & 2 deletions apps/antalmanac/src/lib/grades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,20 @@ class _Grades {
department,
ge,
instructor,
sectionCode,
}: {
department?: string;
ge?: GE;
instructor?: string;
sectionCode?: string;
}): Promise<void> => {
department = department != 'ALL' ? department : undefined;
ge = ge != 'ANY' ? ge : undefined;
instructor = instructor != '' ? instructor : undefined;
sectionCode = sectionCode != '' ? sectionCode : undefined;

if (!department && !ge && !instructor)
throw new Error('populateGradesCache: Must provide either department, ge, or instructor');
if (!department && !ge && !instructor && !sectionCode)
throw new Error('populateGradesCache: Must provide either department, ge, instructor, or section code');

const queryKey = `${department ?? ''}${ge ?? ''}`;

Expand Down
2 changes: 1 addition & 1 deletion apps/backend/.env.sample → apps/backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ MAPBOX_ACCESS_TOKEN=pk.abc123

# Anteater API key.
# If you don't have a key, you can get one at https://dashboard.anteaterapi.com
ANTEATER_API_KEY=placeholder
ANTEATER_API_KEY=placeholder

0 comments on commit 34a4088

Please sign in to comment.