]> git.sesse.net Git - ccbs/blob - bigscreen/fetch_list_of_finished_groups.cpp
Set default resolution to 1024x768.
[ccbs] / bigscreen / fetch_list_of_finished_groups.cpp
1 #include "fetch_list_of_finished_groups.h"
2
3 FetchListOfFinishedGroups::FetchListOfFinishedGroups(unsigned tournament, std::vector<SkeletonGroup> *active) :
4         tournament(tournament), active(active) {}
5
6 void FetchListOfFinishedGroups::operator() (pqxx::transaction<> &t)
7 {
8         // make sure we start with an empty list
9         active->erase(active->begin(), active->end());
10
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) NOT IN ( SELECT tournament,round FROM bigscreen.active_groups ) ORDER BY tournament,round,parallel") );
14
15         for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) {
16                 SkeletonGroup g;
17
18                 g.tournament = i["tournament"].as(g.tournament);
19                 g.round = i["round"].as(g.round);
20                 g.parallel = i["parallel"].as(g.parallel);
21                 g.num_machines = 1;
22
23                 active->push_back(g);
24         }
25 }