X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=html%2Fdo-edit-scores.pl;h=95006e090af36204f39a8a5ac9481f2b282787d0;hp=945e25cdc298ef2c1615cf57450ba0015b4f4e03;hb=11b5968454610745e6cd47fb71edea1218f835dd;hpb=c88ada628f39026c983b389ef6f3b0ae4874e7d4 diff --git a/html/do-edit-scores.pl b/html/do-edit-scores.pl index 945e25c..95006e0 100755 --- a/html/do-edit-scores.pl +++ b/html/do-edit-scores.pl @@ -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; } @@ -68,8 +72,12 @@ for my $p ($cgi->param()) { } } +$dbh->do('UPDATE bigscreen.active_groups SET last_updated=now() WHERE tournament=? AND round=? AND parallel=?', + undef, $tournament, $round, $group); +$dbh->do('NOTIFY scores'); + $dbh->commit; $dbh->disconnect; -ccbs::print_see_other('show-tournament.pl?id=' . $tournament); +ccbs::print_see_other('show-tournament.pl?id=' . $tournament . '#round' . $round);