X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=html%2Fdo-edit-scores.pl;h=fe29c168abe76ddc895101fa02f0e67aaec502bc;hp=997d9659be23eaf5582237b44007c31b6b509ff8;hb=9e9977d8d73f4f28e6f8f3d6d1a007a859bc3955;hpb=9181c99a0c28191b9d6049377b990a0a03e8ba4b diff --git a/html/do-edit-scores.pl b/html/do-edit-scores.pl index 997d965..fe29c16 100755 --- a/html/do-edit-scores.pl +++ b/html/do-edit-scores.pl @@ -8,7 +8,25 @@ my $dbh = ccbs::db_connect(); my $cgi = new CGI; my $tournament = $cgi->param('tournament'); +my $round = $cgi->param('round'); +my $group = $cgi->param('group'); +$dbh->{AutoCommit} = 0; + +# Loop through all parameters and see what parameters differ between old- and current +# versions +for my $p ($cgi->param()) { + next if ($p =~ /^old-(.*?)$/); + next unless (defined($cgi->param('old-' . $p))); + next if ($cgi->param($p) eq $cgi->param('old-' . $p)); + + if ($p =~ /^score(\d+)-(\d+)/) { + $dbh->do('UPDATE scores SET score=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef, + $cgi->param($p), $tournament, $round, $group, $1, $2); + } +} + +$dbh->commit; $dbh->disconnect; ccbs::print_see_other('show-tournament.pl?id=' . $tournament);