File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
apps/web/src/modules/report-parsing Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ export default function DegreeProgreeUpload({
8888 // Extract and parse course history
8989 try {
9090 const historyText = await extractCourseHistory ( file ) ;
91+
9192 const courses = parseCourseHistory ( historyText ) ;
93+
9294 const userCourses = transformToUserCourses ( courses ) ;
9395
9496 // Store parsed courses and open confirmation modal
Original file line number Diff line number Diff line change @@ -77,9 +77,28 @@ export function transformToUserCourses(
7777 const { year, term } = normalizeTerm ( course . term ) ;
7878 const courseCode = `${ course . subject } ${ course . catalogNumber } ` ;
7979
80+ let title = course . title . trim ( ) ;
81+
82+ if ( title . endsWith ( ":" ) ) {
83+ title = title . slice ( 0 , - 1 ) . trim ( ) ;
84+ }
85+
86+ if ( course . meta ?. CourseTopic ) {
87+ let topic = course . meta . CourseTopic . trim ( ) ;
88+ topic = topic . replace ( / ^ \s * \d + \s * - \s * / , "" ) . trim ( ) ;
89+
90+ if ( topic ) {
91+ if ( title . includes ( ":" ) ) {
92+ title = `${ title } - ${ topic } ` ;
93+ } else {
94+ title = `${ title } : ${ topic } ` ;
95+ }
96+ }
97+ }
98+
8099 const userCourse : UserCourse = {
81100 courseCode,
82- title : course . title ,
101+ title : title ,
83102 year,
84103 term,
85104 } ;
You can’t perform that action at this time.
0 commit comments