X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bigscreen%2Ffetch_max_score_for_songs.cpp;h=c493a67b134632077bb752de0c5ea0e4ed1e554e;hb=bf9387900ec73b0703128d8d2aa11996509006b8;hp=4170e33ea552f3c525680ecf3657022fb231ce44;hpb=356ec27da8968144a38f4be531957a4e5dab1fff;p=ccbs diff --git a/bigscreen/fetch_max_score_for_songs.cpp b/bigscreen/fetch_max_score_for_songs.cpp index 4170e33..c493a67 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 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);