Skip to content

Commit

Permalink
fix: small changes in scraper to delete removed groups (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
olekszczepanowski authored Jan 15, 2025
1 parent 079508b commit 25bd9bd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/commands/scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export default class Scraper extends BaseCommand {
}),
);
this.logger.log("Scraping groups details");
const processedGroupIds: number[] = [];
for (const registration of registrations) {
for (const course of registration.courses) {
const detailsUrls = (await Promise.all(
Expand Down Expand Up @@ -222,11 +223,14 @@ export default class Scraper extends BaseCommand {
},
);

processedGroupIds.push(group.id);

await group.related("lecturers").sync(lecturerIds);
}),
);
}
}
await Group.query().whereNotIn("id", processedGroupIds).delete();
this.logger.log("Groups details scraped");
}
}

0 comments on commit 25bd9bd

Please sign in to comment.