7 my $dbh = ccbs::db_connect();
10 my $tournament = $cgi->param('tournament');
11 my $round = $cgi->param('round');
12 my $group = $cgi->param('group');
14 $dbh->{AutoCommit} = 0;
16 # Loop through all parameters and see what parameters differ between old- and current
18 for my $p ($cgi->param()) {
19 next if ($p =~ /^old-(.*?)$/);
20 next unless (defined($cgi->param('old-' . $p)));
21 next if ($cgi->param($p) eq $cgi->param('old-' . $p));
23 my $val = $cgi->param($p);
24 undef $val if ($val =~ /^\s*$/);
26 if ($p =~ /^score(\d+)-(\d+)/) {
27 $dbh->do('UPDATE scores SET score=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
28 $val, $tournament, $round, $group, $1, $2);
29 } elsif ($p =~ /^playmode(\d+)-(\d+)/) {
30 $dbh->do('UPDATE scores SET playmode=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
31 $val, $tournament, $round, $group, $1, $2);
32 } elsif ($p =~ /^difficulty(\d+)-(\d+)/) {
33 $dbh->do('UPDATE scores SET difficulty=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
34 $val, $tournament, $round, $group, $1, $2);
35 } elsif ($p =~ /^song(\d+)-(\d+)/) {
36 $dbh->do('UPDATE scores SET song=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=? AND chosen=\'t\'', undef,
37 $val, $tournament, $round, $group, $1, $2);
44 ccbs::print_see_other('show-tournament.pl?id=' . $tournament);