Updated the score edit functionality to check for steps on the selected mix only.
authorSteinar H. Gunderson <sesse@samfundet.no>
Fri, 18 Feb 2005 15:38:06 +0000 (15:38 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Fri, 18 Feb 2005 15:38:06 +0000 (15:38 +0000)
html/do-edit-scores.pl

index 945e25c..5db7cbf 100755 (executable)
@@ -13,6 +13,9 @@ my $group = $cgi->param('group');
 
 $dbh->{AutoCommit} = 0;
 
+my $tournamentdata = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN machines WHERE tournament=?',
+       undef, $tournament);
+
 my %checked_songs = ();
 
 # Loop through all parameters and see what parameters differ between old- and current
@@ -35,15 +38,16 @@ for my $p ($cgi->param()) {
                if (defined($cgi->param("playmode$1-$2"))   && $cgi->param("playmode$1-$2") !~ /^\s*$/ &&
                    defined($cgi->param("difficulty$1-$2")) && $cgi->param("difficulty$1-$2") !~ /^\s*$/ &&
                    defined($cgi->param("song$1-$2"))       && $cgi->param("song$1-$2") !~ /^\s*$/) {
-                       my $ref = $dbh->selectrow_hashref('SELECT COUNT(*) AS num_songs FROM songratings WHERE song=? AND playmode=? AND difficulty=?',
+                       my $ref = $dbh->selectrow_hashref('SELECT COUNT(*) AS num_songs FROM songratings WHERE song=? AND playmode=? AND difficulty=? AND machine=?',
                                undef, $cgi->param("song$1-$2"), $cgi->param("playmode$1-$2"),
-                               $cgi->param("difficulty$1-$2"));
+                               $cgi->param("difficulty$1-$2"), $tournamentdata->{'machine'});
                        if ($ref->{'num_songs'} != 1) {
                                # Fetch the name of the song if we can
                                $ref = $dbh->selectrow_hashref('SELECT title FROM songs WHERE song=?',
                                        undef, $cgi->param("song$1-$2"));
                                ccbs::user_error("Sangen $ref->{'title'} har ikke steps for " .
-                                       $cgi->param("playmode$1-$2") . " " . $cgi->param("difficulty$1-$2") . ".");
+                                       $cgi->param("playmode$1-$2") . " " . $cgi->param("difficulty$1-$2") . " på ".
+                                       $tournamentdata->{'machinename'} . ".");
                        }
                        $checked_songs{"$1-$2"} = 1;
                }