Add placeholder for missing fighter names

This commit is contained in:
Clarence Chan committed 2025-05-03 13:16:40 -04:00
1 parent e129ffa7c3
commit 95a9ffd977
1 file changed
+12 -11
+12 -11
View File
@@ -86,17 +86,18 @@ function convertLiToStr(li: HTMLElement) {
else if (bout.includes("Catchweight")) weightClass = "CW"; else if (bout.includes("Catchweight")) weightClass = "CW";
// Extract and format fighter names with weightclass // Extract and format fighter names with weightclass
const red = li const red =
.querySelector(".c-listing-fight__corner-name--red") li
?.textContent?.replaceAll("\n", "") .querySelector(".c-listing-fight__corner-name--red")
.replace(/\s+/g, " ") ?.textContent?.replaceAll("\n", "")
.trim(); .replace(/\s+/g, " ")
const blue = li .trim() || "___";
.querySelector(".c-listing-fight__corner-name--blue") const blue =
?.textContent?.replaceAll("\n", "") li
.replace(/\s+/g, " ") .querySelector(".c-listing-fight__corner-name--blue")
.trim(); ?.textContent?.replaceAll("\n", "")
if (!red || !blue) throw new Error("Failed to retrieve fighter names"); .replace(/\s+/g, " ")
.trim() || "___";
const ranks = li const ranks = li
.querySelectorAll( .querySelectorAll(