Make the number of machines settable via the web interface.
[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
15 $dbh->{AutoCommit} = 0;
16
17 $dbh->do('DELETE FROM bigscreen.active_groups WHERE tournament=? AND round=? AND parallel=?', undef,
18         $tournament, $round, $parallel);
19 if ($cgi->param('show') eq 'true') {
20         $dbh->do('INSERT INTO bigscreen.active_groups (tournament, round, parallel, num_machines, last_updated) VALUES (?,?,?,?,now())',
21                 undef, $tournament, $round, $parallel, $num_machines);
22 }
23
24 $dbh->do('NOTIFY active_groups');
25
26 $dbh->commit;
27 $dbh->disconnect;
28
29 ccbs::print_see_other('show-tournament.pl?id=' . $tournament);
30