X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bigscreen%2Ffetch_group.cpp;h=2c58762de64e9550156694f444c4dd62902bf79c;hb=2bd63a87ed5f7984721a86627269d21fc71a0139;hp=62fbd5000859d0fb43b4ca71c17d283ada6b2169;hpb=b11d796b525a70f1458ce2d7188baac4b6d5aa27;p=ccbs diff --git a/bigscreen/fetch_group.cpp b/bigscreen/fetch_group.cpp index 62fbd50..2c58762 100644 --- a/bigscreen/fetch_group.cpp +++ b/bigscreen/fetch_group.cpp @@ -6,7 +6,7 @@ FetchGroup::FetchGroup(unsigned tournament, unsigned round, unsigned parallel, G void FetchGroup::operator() (pqxx::transaction<> &t) { // note: this _will_ break if any song has more than one short title! - pqxx::result res( t.exec("SELECT round,parallel,position,playmode,difficulty,position,songnumber,player,nick,song,title,COALESCE(shorttitle,title) AS shorttitle,artist,chosen,score FROM roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs NATURAL LEFT JOIN songshorttitles WHERE " + pqxx::result res( t.exec("SELECT numqualifying,playmode,difficulty,position,songnumber,player,nick,song,title,COALESCE(shorttitle,title) AS shorttitle,artist,chosen,score FROM rounds NATURAL JOIN roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs NATURAL LEFT JOIN songshorttitles WHERE " "tournament=" + pqxx::to_string(tournament) + " AND " + "round=" + pqxx::to_string(round) + " AND " + "parallel=" + pqxx::to_string(parallel) + " " + @@ -19,6 +19,8 @@ void FetchGroup::operator() (pqxx::transaction<> &t) // massage the data we get back into a Group object and children int curr_player = -1; for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) { + curr_group.num_qualifying = i["numqualifying"].as(curr_group.num_qualifying); + if (i["player"].as(curr_player) != curr_player) { Player p; @@ -58,9 +60,5 @@ void FetchGroup::operator() (pqxx::transaction<> &t) curr_group.players[curr_group.players.size() - 1].scores.push_back(sc); } -} - -void FetchGroup::OnCommit() -{ *dest_group = curr_group; }