Skip to content

Commit

Permalink
allow values to be zero
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Sep 27, 2021
1 parent 64c8e75 commit 221546e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/modules/gametree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand Down

0 comments on commit 221546e

Please sign in to comment.