X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bigscreen%2Ffetch_max_score_for_songs.cpp;h=990d1e8cad9caa94bdea9009fe7706f46b735e3e;hb=bb5fde29696b2b5bce9e4431c01fe9ec29f4207c;hp=4170e33ea552f3c525680ecf3657022fb231ce44;hpb=5993426cc359ecede127053736d97714761b9bad;p=ccbs diff --git a/bigscreen/fetch_max_score_for_songs.cpp b/bigscreen/fetch_max_score_for_songs.cpp index 4170e33..990d1e8 100644 --- a/bigscreen/fetch_max_score_for_songs.cpp +++ b/bigscreen/fetch_max_score_for_songs.cpp @@ -7,9 +7,9 @@ void FetchMaxScoreForSongs::operator() (pqxx::transaction<> &t) { score->erase(score->begin(), score->end()); - pqxx::result res( t.exec("SELECT song,MAX(feetrating)*1000 AS max_score FROM songratings WHERE " - " machine=( SELECT machine FROM tournaments WHERE tournament=" + pqxx::to_string(tournament) + ") AND playmode='single' GROUP BY song") ); - + pqxx::result res( t.exec("SELECT * FROM get_max_score_for_songs(" + + pqxx::to_string(tournament) + ", 'single')") ); + for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) { unsigned song, max_score; song = i["song"].as(song);