Skip to content

Commit

Permalink
fix: course unit filtering logic
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Apr 23, 2024
1 parent bd9a831 commit 9b8d3b5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,10 @@ const getArchivedCoursesToDelete = async (courses) => {

const coursesHandler = async (courses) => {
// Filter out old AY courses. Already existing ones remain in db.
const courseUnits = [].concat(...courses.map((course) => course.courseUnits)).filter(({ code }) => code.startsWith('AY') && !code.match('^AY[0-9]+$'))
const courseUnits = courses
.flatMap((course) => course.courseUnits)
.filter(({ code }) => !(code.startsWith('AY') && !code.match('^AY[0-9]+$')))

await createCourseUnits(courseUnits)

const includeCurs = await getIncludeCurs()
Expand Down

0 comments on commit 9b8d3b5

Please sign in to comment.