Correct the logic for finding out what songs a player can choose (only random songs...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 20 Feb 2005 17:15:53 +0000 (17:15 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 20 Feb 2005 17:15:53 +0000 (17:15 +0000)
bigscreen/fetch_max_score_for_player.cpp

index 70472b0..f63a582 100644 (file)
@@ -7,8 +7,8 @@ void FetchMaxScoreForPlayer::operator() (pqxx::transaction<> &t)
 {
        pqxx::result res( t.exec("SELECT MAX(feetrating)*1000 AS max_score FROM songratings WHERE " 
                "machine=( SELECT machine FROM tournaments WHERE tournament=" + pqxx::to_string(tournament) + ") AND "
-               "(song NOT IN ( SELECT song FROM scores WHERE tournament=" + pqxx::to_string(tournament) + " AND song IS NOT NULL AND ( "
-               "round=" + pqxx::to_string(round) + " OR parallel=0 OR ( player=" + pqxx::to_string(player) + " AND chosen='t' ) ) ) )") );
+               "song NOT IN ( SELECT song FROM scores WHERE tournament=" + pqxx::to_string(tournament) + " AND song IS NOT NULL AND ( "
+               "parallel=0 OR ( player=" + pqxx::to_string(player) + " AND ( chosen='t' OR round=" + pqxx::to_string(round) + " ) ) ) )") );
        
        *score = res.at(0)["max_score"].as(*score);
 }