]> git.sesse.net Git - ccbs/blob - html/start-tournament.pl
Replace the web frontend's rank calculations with the stored procedures.
[ccbs] / html / start-tournament.pl
1 #! /usr/bin/perl
2
3 use ccbs;
4 use strict;
5 use warnings;
6
7 my $cgi = new CGI;
8 my $id = $cgi->param('id');
9
10 my $dbh = ccbs::db_connect();
11
12 my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
13 my $ref = $dbh->selectrow_hashref('SELECT count(*) AS num_registered FROM tournamentparticipation WHERE tournament=?', undef, $id);
14 my $num_registered = $ref->{'num_registered'};
15
16 ccbs::print_header();
17 ccbs::process_template('start-tournament.tmpl', $tournament->{'tournamentname'}, {
18         tournament => $tournament,
19         num_registered => $num_registered
20 });
21 $dbh->disconnect;