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
+6 -5
+6 -5
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 =
li
.querySelector(".c-listing-fight__corner-name--red") .querySelector(".c-listing-fight__corner-name--red")
?.textContent?.replaceAll("\n", "") ?.textContent?.replaceAll("\n", "")
.replace(/\s+/g, " ") .replace(/\s+/g, " ")
.trim(); .trim() || "___";
const blue = li const blue =
li
.querySelector(".c-listing-fight__corner-name--blue") .querySelector(".c-listing-fight__corner-name--blue")
?.textContent?.replaceAll("\n", "") ?.textContent?.replaceAll("\n", "")
.replace(/\s+/g, " ") .replace(/\s+/g, " ")
.trim(); .trim() || "___";
if (!red || !blue) throw new Error("Failed to retrieve fighter names");
const ranks = li const ranks = li
.querySelectorAll( .querySelectorAll(