fix(ui): multiple instructors are formatted properly, displays last name only, and are capitalized in all course blocks (#342) (#403)

* fix(ui): updated multiple instructor name formatting in course blocks

* fix(ui): display instructor last names only in all course blocks

* refactor: use instructor toString when getting instructor full name

* refactor: toString in useFlattenedCourseSchedule without template literal

Co-authored-by: Samuel Gunter <29130894+Samathingamajig@users.noreply.github.com>

* refactor: delete type hint and unnecessary comments

* fix(ui): instructor names semicolon delimiter in calendar course block

* fix(ui): removed 'unknown' when there are no instructors

* fix(ui): change - to &ndash

* fix(ui): changed - to ndash in hook

---------

Co-authored-by: Samuel Gunter <29130894+Samathingamajig@users.noreply.github.com>
This commit is contained in:
adityamkk
2024-10-29 16:07:26 -05:00
committed by GitHub
parent b3ae91d8f3
commit 50e88fa015
3 changed files with 10 additions and 10 deletions

View File

@@ -95,9 +95,11 @@ function extractCourseInfo(course: Course) {
let courseDeptAndInstr = `${course.department} ${course.number}`;
const mainInstructor = course.instructors[0];
if (mainInstructor) {
courseDeptAndInstr += ` ${mainInstructor.toString({ format: 'first_last', case: 'capitalize' })}`;
if (course.instructors.length > 0) {
courseDeptAndInstr += ' \u2013 ';
courseDeptAndInstr += course.instructors
.map(instructor => instructor.toString({ format: 'last', case: 'capitalize' }))
.join('; ');
}
return { status, courseDeptAndInstr, meetings, course };