diff --git a/src/components/Goban.js b/src/components/Goban.js index df9566ab..3c72e437 100644 --- a/src/components/Goban.js +++ b/src/components/Goban.js @@ -420,7 +420,7 @@ export default class Goban extends Component { for (const v in board.childrenInfo) { const [x, y] = v.split(',').map(x => +x) const {visits, winrate, scoreLead} = board.childrenInfo[v] - if (visits && winrate) { + if (isFinite(visits) && isFinite(winrate)) { variations.push({vertex: [x, y], visits, winrate, scoreLead}) } } diff --git a/src/modules/gametree.js b/src/modules/gametree.js index 91b0aa5e..d9cef89d 100644 --- a/src/modules/gametree.js +++ b/src/modules/gametree.js @@ -358,12 +358,18 @@ export function getBoard(tree, id) { type = 'good' } - const visits = node.data.VISITS || null - const winrate = - (node.data.WINRATE && (0.5 + sign * (node.data.WINRATE - 0.5)) * 100) || - null - const scoreLead = - (node.data.SCORELEAD && node.data.SCORELEAD * sign) || null + let visits = null + let winrate = null + let scoreLead = null + if (isFinite(node.data.VISITS)) { + visits = +node.data.VISITS + } + if (isFinite(node.data.WINRATE)) { + winrate = (0.5 + sign * (node.data.WINRATE - 0.5)) * 100 + } + if (isFinite(node.data.SCORELEAD)) { + scoreLead = node.data.SCORELEAD * sign + } list[v] = {sign, type, visits, winrate, scoreLead} }