]> git.sesse.net Git - ccbs/blobdiff - html/do-edit-scores.pl
Removed name= on the submit buttons again, we don't need it anymore.
[ccbs] / html / do-edit-scores.pl
index fe29c168abe76ddc895101fa02f0e67aaec502bc..1ae15471634267a1ff51290d9395222c0d9e81a8 100755 (executable)
@@ -20,9 +20,21 @@ for my $p ($cgi->param()) {
        next unless (defined($cgi->param('old-' . $p)));
        next if ($cgi->param($p) eq $cgi->param('old-' . $p));
 
+       my $val = $cgi->param($p);
+       undef $val if ($val =~ /^\s*$/);
+
        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);
+                       $val, $tournament, $round, $group, $1, $2);
+       } elsif ($p =~ /^playmode(\d+)-(\d+)/) {
+               $dbh->do('UPDATE scores SET playmode=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
+                       $val, $tournament, $round, $group, $1, $2);
+       } elsif ($p =~ /^difficulty(\d+)-(\d+)/) {
+               $dbh->do('UPDATE scores SET difficulty=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
+                       $val, $tournament, $round, $group, $1, $2);
+       } elsif ($p =~ /^song(\d+)-(\d+)/) {
+               $dbh->do('UPDATE scores SET song=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=? AND chosen=\'t\'', undef,
+                       $val, $tournament, $round, $group, $1, $2);
        }
 }