1 #include "fetch_list_of_finished_groups.h"
3 FetchListOfFinishedGroups::FetchListOfFinishedGroups(unsigned tournament, std::vector<SkeletonGroup> *active) :
4 tournament(tournament), active(active) {}
6 void FetchListOfFinishedGroups::operator() (pqxx::transaction<> &t)
8 // make sure we start with an empty list
9 active->erase(active->begin(), active->end());
11 // find all groups with no empty scores that are not already shown on the bigscreen
12 pqxx::result res( t.exec("SELECT tournament,round,parallel FROM scores WHERE tournament=" +
13 pqxx::to_string(tournament) + " GROUP BY tournament,round,parallel HAVING COUNT(*)=COUNT(score) AND (tournament,round,parallel) NOT IN ( SELECT tournament,round,parallel FROM bigscreen.active_groups ) AND parallel<>0 ORDER BY tournament,round,parallel") );
15 for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) {
18 g.tournament = i["tournament"].as(g.tournament);
19 g.round = i["round"].as(g.round);
20 g.parallel = i["parallel"].as(g.parallel);