]> git.sesse.net Git - ccbs/blob - html/do-set-active-round.pl
(no commit message)
[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
14 $dbh->{AutoCommit} = 0;
15
16 $dbh->do('DELETE FROM bigscreen.active_groups WHERE tournament=? AND round=? AND parallel=?', undef,
17         $tournament, $round, $parallel);
18 if ($cgi->param('show') eq 'true') {
19         $dbh->do('INSERT INTO bigscreen.active_groups (tournament, round, parallel, num_machines, last_updated) VALUES (?,?,?,1,now())',
20                 undef, $tournament, $round, $parallel);
21 }
22
23 $dbh->do('NOTIFY active_groups');
24
25 $dbh->commit;
26 $dbh->disconnect;
27
28 ccbs::print_see_other('show-tournament.pl?id=' . $tournament);
29