X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Ffetch_group.cpp;h=75e458a4f9b80ed9c60c598935c3ca51846ffa77;hp=6411525ba4f5f49eb9665a5ddd2b4d0ba1c3ac05;hb=32d2a098bec8a1ace0f86f28110da45d060f8447;hpb=9259b72537dbfc4100a5b65bd58b3a9a61d1fc2d diff --git a/bigscreen/fetch_group.cpp b/bigscreen/fetch_group.cpp index 6411525..75e458a 100644 --- a/bigscreen/fetch_group.cpp +++ b/bigscreen/fetch_group.cpp @@ -5,7 +5,8 @@ FetchGroup::FetchGroup(unsigned tournament, unsigned round, unsigned parallel, G void FetchGroup::operator() (pqxx::transaction<> &t) { - pqxx::result res( t.exec("SELECT round,parallel,position,playmode,difficulty,songnumber,player,nick,song,title,artist,chosen,score FROM roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs WHERE " + // 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 " "tournament=" + pqxx::to_string(tournament) + " AND " + "round=" + pqxx::to_string(round) + " AND " + "parallel=" + pqxx::to_string(parallel) + " " + @@ -41,6 +42,7 @@ void FetchGroup::operator() (pqxx::transaction<> &t) so.id = i["song"].as(so.id); so.title = i["title"].as(so.title); so.artist = i["artist"].as(so.artist); + so.short_title = i["shorttitle"].as(so.short_title); } sc.song = so; @@ -50,6 +52,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);