X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bigscreen%2Ffetch_group.cpp;h=62fbd5000859d0fb43b4ca71c17d283ada6b2169;hb=b11d796b525a70f1458ce2d7188baac4b6d5aa27;hp=bdaa0c9a9b309e469e24fde3db634eb51d983030;hpb=6cd673299df1e8eaabdf6e538b19dc617514c82a;p=ccbs diff --git a/bigscreen/fetch_group.cpp b/bigscreen/fetch_group.cpp index bdaa0c9..62fbd50 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,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 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 " "tournament=" + pqxx::to_string(tournament) + " AND " + "round=" + pqxx::to_string(round) + " AND " + "parallel=" + pqxx::to_string(parallel) + " " + @@ -23,6 +23,7 @@ void FetchGroup::operator() (pqxx::transaction<> &t) Player p; p.id = i["player"].as(p.id); + p.position = i["position"].as(p.id); p.nick = i["nick"].as(p.nick); p.total = 0; p.rank = 1; @@ -52,6 +53,7 @@ void FetchGroup::operator() (pqxx::transaction<> &t) sc.score = -1; } else { sc.score = i["score"].as(sc.score); + curr_group.players[curr_group.players.size() - 1].total += sc.score; } curr_group.players[curr_group.players.size() - 1].scores.push_back(sc);