]> git.sesse.net Git - ccbs/blobdiff - html/do-start-round.pl
Added preliminary backend for creating rounds and groups.
[ccbs] / html / do-start-round.pl
diff --git a/html/do-start-round.pl b/html/do-start-round.pl
new file mode 100755 (executable)
index 0000000..5cd6779
--- /dev/null
@@ -0,0 +1,27 @@
+#! /usr/bin/perl
+
+use ccbs;
+use strict;
+use warnings;
+
+my $dbh = ccbs::db_connect();
+my $cgi = new CGI;
+
+my $tournament = $cgi->param('tournament');
+my $round = $cgi->param('round');
+my $num_random = $cgi->param('numrandom');
+my $num_chosen = $cgi->param('numchosen');
+my $num_groups = $cgi->param('numgroups');
+my $num_qual = $cgi->param('numqual');
+
+$dbh->do('INSERT INTO rounds (tournament, round, randomsongs, chosensongs, numqualifying) VALUES (?, ?, ?, ?, ?)',
+       undef, $tournament, $round, $num_random, $num_chosen, $num_qual);
+
+for my $i (1..$num_groups) {
+       $dbh->do('INSERT INTO groups (tournament, round, parallel) VALUES (?, ?, ?)',
+               undef, $tournament, $round, $i);
+}
+
+ccbs::print_see_other('show-tournamelt.pl?id=' . $tournament);
+
+$dbh->disconnect;