+#include <cstdio>
#include <algorithm>
#include "groupscreen.h"
#include "fetch_group.h"
#include "fetch_max_score_for_song.h"
#include "fetch_max_score_for_player.h"
+#include "fetch_needs_update.h"
#include "fonts.h"
GroupScreen::GroupScreen(pqxx::connection &conn, unsigned tournament, unsigned round, unsigned parallel)
bool GroupScreen::check_invalidated()
{
- // we might want to do this slightly more sophisticated later, but for now this will do
- return !valid || scores_changed.get_flag();
+ if (!valid)
+ return true;
+ if (!scores_changed.get_flag())
+ return false;
+
+ bool needs_update;
+ conn.perform(FetchNeedsUpdate(last_updated, tournament, round, parallel, &needs_update));
+
+ if (!needs_update)
+ scores_changed.reset_flag();
+
+ return needs_update;
}
void GroupScreen::draw(unsigned char *buf)
Group group;
conn.perform(FetchGroup(tournament, round, parallel, &group));
+ gettimeofday(&last_updated, NULL);
memset(buf, 0, 800 * 600 * 4);