Skip to content

Commit

Permalink
fix: UNI-265 update get courses route archived courses (#272)
Browse files Browse the repository at this point in the history
* fix: modify insertCourses query to split insert into chunks

This is to prevent postgres from throwing an error when inserting a
large amount of tables

* filter out junk data when parsing term info
  • Loading branch information
adrianbalbs authored Apr 6, 2024
1 parent 047e6d2 commit 8869e1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions migration/src/migrate/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ export default class MigrationRepository {
}

async insertCourses(courses: CourseEntity[]): Promise<void> {
await this.manager
.createQueryBuilder()
.insert()
.into("courses")
.values(courses)
.execute();
await this.manager.save(courses, { chunk: 1000 });
}

async updateUser(zid: string) {
Expand Down
2 changes: 1 addition & 1 deletion migration/src/migrate/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default class MigrationService {
console.log("Unknown term: ", term);
}
}
return termNums;
return termNums.filter((term) => !isNaN(term));
};

const entity = new CourseEntity();
Expand Down

0 comments on commit 8869e1b

Please sign in to comment.