4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
da85ec1199 Add debug logging for missing competitor lookup
Co-authored-by: fabrice404 <12575390+fabrice404@users.noreply.github.com>
2026-02-06 21:48:23 +00:00
copilot-swe-agent[bot]
7b4c983be6 Fix critical bugs: null checks and error handling
Co-authored-by: fabrice404 <12575390+fabrice404@users.noreply.github.com>
2026-02-06 21:47:39 +00:00
copilot-swe-agent[bot]
70b0b4e8c7 Initial analysis: identified bugs in olympics-calendar
Co-authored-by: fabrice404 <12575390+fabrice404@users.noreply.github.com>
2026-02-06 21:46:58 +00:00
copilot-swe-agent[bot]
c8f55e6973 Initial plan 2026-02-06 21:45:22 +00:00
4 changed files with 30 additions and 8 deletions

View File

@@ -49,7 +49,7 @@ export class ICSGenerator {
for (const lang of this.calendar.languages) {
const pathSportKey = sportKey || "all-sports";
let pathCalendar = "calendar";
if (type != "all-events") {
if (type !== "all-events") {
pathCalendar = type;
} else if (nocKey) {
pathCalendar = nocKey;
@@ -150,7 +150,15 @@ export class ICSGenerator {
flag: getFlag(team?.key || ""),
};
}
const competitor = this.calendar.competitors.find(comp => comp.code === competitorId)!;
const competitor = this.calendar.competitors.find(comp => comp.code === competitorId);
if (!competitor) {
this.debug(`Competitor not found: ${competitorId}`);
return {
noc: "",
name: competitorId,
flag: "🏳️",
};
}
return {
noc: competitor.noc,
name: competitor.name,

View File

@@ -4,10 +4,14 @@ import nodeCron from "node-cron";
import { Scraper } from "./scraper";
const main = () => {
nodeCron.schedule("*/10 * * * *", () => {
removeSync("./cache/schedules");
const scraper = new Scraper();
scraper.scrape();
nodeCron.schedule("*/10 * * * *", async () => {
try {
removeSync("./cache/schedules");
const scraper = new Scraper();
await scraper.scrape();
} catch (error) {
console.error("Error during scheduled scrape:", error);
}
});
nodeCron.schedule("0 0 * * *", () => {
@@ -16,7 +20,9 @@ const main = () => {
});
const scraper = new Scraper();
scraper.scrape();
scraper.scrape().catch((error) => {
console.error("Error during initial scrape:", error);
});
};
main();

View File

@@ -318,6 +318,7 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.11.tgz",
"integrity": "sha512-/Af7O8r1frCVgOz0I62jWUtMohJ0/ZQU/ZoketltOJPZpnb17yoNc9BSoVuV9qlaIXJiPNOpsfq4ByFajSArNQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -367,6 +368,7 @@
"integrity": "sha512-BtE0k6cjwjLZoZixN0t5AKP0kSzlGu7FctRXYuPAm//aaiZhmfq1JwdYpYr1brzEspYyFeF+8XF5j2VK6oalrA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.54.0",
"@typescript-eslint/types": "8.54.0",
@@ -583,6 +585,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -983,6 +986,7 @@
"integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -2022,6 +2026,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -2124,6 +2129,7 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View File

@@ -147,7 +147,9 @@ export class Scraper {
for (const noc of this.nocs) {
const found = data.nocs.find((n) => n.id === noc.key);
this.setNoc(found.id, found.name, lang.code);
if (found) {
this.setNoc(found.id, found.name, lang.code);
}
}
}
}