commit 6c3ab7681ab11f14a812fe61768558447df4e82d (patch)
parent 19cb631df5c2e0ab8a121bb37296a79b657560a7
Author: Alex Karle <alex@karle.co>
Date: Thu, 14 May 2020 20:48:39 -0400
Euchre::Host: Modify list_tables returned JSON
These should be "tables" not "games"! Whoops.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gloat.pl b/gloat.pl
@@ -20,7 +20,7 @@ get '/' => sub {
get '/tables' => sub {
my $c = shift;
- $c->render(json => list_tables);
+ $c->render(json => { tables => list_tables });
};
get '/debug' => sub {
diff --git a/lib/Euchre/Host.pm b/lib/Euchre/Host.pm
@@ -176,10 +176,10 @@ sub leave_table {
}
sub list_tables {
- my $json = { games => [] };
+ my @tables;
for my $k (keys %DEALERS) {
my $d = $DEALERS{$k};
- push @{$json->{games}}, {
+ push @tables, {
name => $k,
phase => $d->game->phase,
has_password => $d->password ? 1 : 0,
@@ -187,7 +187,7 @@ sub list_tables {
spectators => [map { $_->name } @{$d->spectators}],
};
}
- return $json;
+ return \@tables;
}