Fix issue with search results without yearpublished tag

This commit is contained in:
Cedric Finance 2022-08-18 00:53:47 +02:00
parent 47d59278a6
commit 3d4041cf16
No known key found for this signature in database

View file

@ -41,14 +41,14 @@ export class BoardGameGeekAPI extends APIModel {
for (const boardgame of Array.from(response.querySelectorAll("boardgame"))) { for (const boardgame of Array.from(response.querySelectorAll("boardgame"))) {
const id = boardgame.attributes.getNamedItem("objectid").value; const id = boardgame.attributes.getNamedItem("objectid").value;
const title = boardgame.querySelector("name").textContent; const title = boardgame.querySelector("name").textContent;
const year = boardgame.querySelector("yearpublished").textContent; const year = boardgame.querySelector("yearpublished")?.textContent ?? "";
ret.push(new BoardGameModel({ ret.push(new BoardGameModel({
dataSource: this.apiName, dataSource: this.apiName,
id, id,
title, title,
englishTitle: title, englishTitle: title,
year, year,
} as BoardGameModel)); } as BoardGameModel));
} }
@ -82,7 +82,7 @@ export class BoardGameGeekAPI extends APIModel {
type: MediaType.BoardGame, type: MediaType.BoardGame,
title, title,
englishTitle: title, englishTitle: title,
year, year: year === "0" ? "" : year,
dataSource: this.apiName, dataSource: this.apiName,
url: `https://boardgamegeek.com/boardgame/${id}`, url: `https://boardgamegeek.com/boardgame/${id}`,
id, id,