]> git.sesse.net Git - ccbs/blob - bigscreen/groupscreen.cpp
Commit groupscreen.cpp...
[ccbs] / bigscreen / groupscreen.cpp
1 #include "groupscreen.h"
2 #include "fetch_group.h"
3
4 GroupScreen::GroupScreen(pqxx::connection &conn, unsigned tournament, unsigned round, unsigned parallel)
5         : tournament(tournament), round(tournament), parallel(parallel), scores_changed(conn, "scores"), conn(conn), valid(false)
6 {
7 }
8
9 GroupScreen::~GroupScreen()
10 {
11 }
12
13 bool GroupScreen::check_invalidated()
14 {
15         // we might want to do this slightly more sophisticated later, but for now this will do
16         return !valid || scores_changed.get_flag();
17 }
18
19 void GroupScreen::draw(unsigned char *buf)
20 {
21         scores_changed.reset_flag();
22
23         Group group;
24         conn.perform(FetchGroup(tournament, round, parallel, &group));
25
26         valid = true;
27 }
28