mirror of
https://github.com/fabrice404/olympics-calendar.git
synced 2026-02-14 12:19:04 +00:00
fix TBD teams
This commit is contained in:
@ -14,6 +14,9 @@ const main = () => {
|
||||
removeSync("./cache/disciplinesevents");
|
||||
removeSync("./cache/nocs");
|
||||
});
|
||||
|
||||
const scraper = new Scraper();
|
||||
scraper.scrape();
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
@ -101,6 +101,9 @@ export class Scraper {
|
||||
|
||||
if (event.competitors) {
|
||||
for (const competitor of event.competitors) {
|
||||
if (competitor.code === "TBD") {
|
||||
continue;
|
||||
}
|
||||
const { code, name, noc, competitorType } = competitor;
|
||||
if (!calendarEvent.nocs.some((n) => n === noc)) {
|
||||
calendarEvent.nocs.push(noc);
|
||||
@ -165,8 +168,10 @@ export class Scraper {
|
||||
}
|
||||
|
||||
private setCompetitor(code: string, noc: string, name: string): void {
|
||||
if (!this.competitors.some((c) => c.code === code)) {
|
||||
this.competitors.push({ code, noc, name });
|
||||
if (code && code !== "undefined") {
|
||||
if (!this.competitors.some((c) => c.code === code)) {
|
||||
this.competitors.push({ code, noc, name });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user