db32ecea50e3e75f43c453cc9b4a50a8c89b5765
[ccbs] / html / do-set-active-round.pl
1 #! /usr/bin/perl
2
3 use ccbs;
4 use strict;
5 use warnings;
6
7 my $dbh = ccbs::db_connect();
8 my $cgi = new CGI;
9
10 my $tournament = $cgi->param('tournament');
11 my $round = $cgi->param('round');
12 my $parallel = $cgi->param('parallel');
13 my $num_machines = $cgi->param('nummachines');
14 my $players_per_machine = $cgi->param('playerspermachine');
15
16 $dbh->{AutoCommit} = 0;
17
18 $dbh->do('DELETE FROM bigscreen.active_groups WHERE tournament=? AND round=? AND parallel=?', undef,
19         $tournament, $round, $parallel);
20 if ($cgi->param('show') eq 'true') {
21         $dbh->do('INSERT INTO bigscreen.active_groups (tournament, round, parallel, num_machines, last_updated, players_per_machine) VALUES (?,?,?,?,now(),?)',
22                 undef, $tournament, $round, $parallel, $num_machines, $players_per_machine);
23 }
24
25 $dbh->do('NOTIFY active_groups');
26
27 $dbh->commit;
28 $dbh->disconnect;
29
30 ccbs::print_see_other('show-tournament.pl?id=' . $tournament);
31