- {[...Array(periodCounts.all).keys()]
- .map((p) => p + 1)
- .map((p) => (
-
-
- {divs}
- {onlineSections.length > 0 && (
-
-
-
- {onlineSections.map(
- (sec: Section, ind: number) => (
-
- {sec.displayName}
-
- {1 + ind}
-
-
- ),
- )}
+
+
+ {divs}
+ {onlineSections.length > 0 && (
+
+
+
+ {onlineSections.map(
+ (sec: Section, ind: number) => (
+
+ {sec.displayName}
+
+ {1 + ind}
+
+
+ )
+ )}
+
-
- )}
+ )}
+
-
+
+ >
);
}
}
diff --git a/app/src/constants/frontend.ts b/app/src/constants/frontend.ts
index 0667c10..14dcfbf 100644
--- a/app/src/constants/frontend.ts
+++ b/app/src/constants/frontend.ts
@@ -15,6 +15,7 @@ export function getSectionColor(sectionInd: number): string {
const SearchByStringExampleMap = new Map([
["course-code", "MAS3114"],
["course-title", "Linear Algebra"],
+ ["instructor", "Huang"],
]);
export function getSearchByStringExample(searchByStr: string): string {
diff --git a/app/src/constants/soc.ts b/app/src/constants/soc.ts
index 3c3d3cf..e5227cf 100644
--- a/app/src/constants/soc.ts
+++ b/app/src/constants/soc.ts
@@ -64,13 +64,19 @@ export function getProgramString(program: Program): string {
export enum SearchBy {
COURSE_CODE = "Course Code",
COURSE_TITLE = "Course Title",
+ INSTRUCTOR = "Instructor",
}
-export const SearchBys = [SearchBy.COURSE_CODE, SearchBy.COURSE_TITLE];
+export const SearchBys = [
+ SearchBy.COURSE_CODE,
+ SearchBy.COURSE_TITLE,
+ SearchBy.INSTRUCTOR,
+];
const SearchByStringMap = new Map([
["course-code", SearchBy.COURSE_CODE],
["course-title", SearchBy.COURSE_TITLE],
+ ["instructor", SearchBy.INSTRUCTOR],
]);
export function getSearchBy(searchByStr: string): SearchBy {
diff --git a/app/src/scripts/soc/soc.tsx b/app/src/scripts/soc/soc.tsx
index 7ed305d..30084a7 100644
--- a/app/src/scripts/soc/soc.tsx
+++ b/app/src/scripts/soc/soc.tsx
@@ -131,6 +131,14 @@ export abstract class SOC_Generic {
return this.courses.filter((c) =>
c.name.toUpperCase().includes(upperPhrase),
);
+ } else if (searchBy === SearchBy.INSTRUCTOR) {
+ return this.courses.filter((c) =>
+ c.sections.some((s) =>
+ s.instructors.some((inst) =>
+ inst.toUpperCase().includes(upperPhrase),
+ ),
+ ),
+ );
}
throw new Error("Unhandled SearchBy.");
}