From: Steinar H. Gunderson Date: Sun, 29 May 2016 14:24:37 +0000 (+0200) Subject: Send out most numbers as actual numbers. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e8fea43561352d3573201f4ebad2538ccd38568c;p=remoteglot-book Send out most numbers as actual numbers. --- diff --git a/www/opening-stats.pl b/www/opening-stats.pl index 0da6e05..f13e0a8 100755 --- a/www/opening-stats.pl +++ b/www/opening-stats.pl @@ -170,14 +170,14 @@ sub get_json_move { my ($white, $draw, $black, $computer, $opening_num, $white_sum_elo, $black_sum_elo, $num_elo, $timestamp, $pgn_file_number, $pgn_start_position, @moves) = split / /, $line; my $json_pos = { - white => $white, - draw => $draw, - black => $black, - computer => $computer, + white => int($white), + draw => int($draw), + black => int($black), + computer => int($computer), white_avg_elo => $num_elo == 0 ? undef : $white_sum_elo / $num_elo, black_avg_elo => $num_elo == 0 ? undef : $black_sum_elo / $num_elo, - num_elo => $num_elo, - opening_num => $opening_num, + num_elo => int($num_elo), + opening_num => $opening_num, # Keep as string. }; my $aux_data = { # Only relevant for the root. pos_hash => $pos_hash * 1,