]> git.sesse.net Git - ccbs/blobdiff - bigscreen/fetch_max_score_for_player.cpp
Read max score for all players in one shot as well, with a new query and an index...
[ccbs] / bigscreen / fetch_max_score_for_player.cpp
diff --git a/bigscreen/fetch_max_score_for_player.cpp b/bigscreen/fetch_max_score_for_player.cpp
deleted file mode 100644 (file)
index f63a582..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "fetch_max_score_for_player.h"
-
-FetchMaxScoreForPlayer::FetchMaxScoreForPlayer(unsigned tournament, unsigned player, unsigned round, unsigned *score)
-       : tournament(tournament), player(player), round(round), score(score) {}
-       
-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 ( "
-               "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);
-}