]> git.sesse.net Git - ccbs/blobdiff - bigscreen/fetch_top_chosen_songs_for_tournament.h
Added a "top 5 chosen songs this tournament" screen.
[ccbs] / bigscreen / fetch_top_chosen_songs_for_tournament.h
diff --git a/bigscreen/fetch_top_chosen_songs_for_tournament.h b/bigscreen/fetch_top_chosen_songs_for_tournament.h
new file mode 100644 (file)
index 0000000..9b177bf
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef _FETCH_TOP_CHOSEN_SONGS_FOR_TOURNAMENT_H
+#define _FETCH_TOP_CHOSEN_SONGS_FOR_TOURNAMENT_H 1
+
+#include <pqxx/transactor>
+#include <vector>
+#include "widestring.h"
+
+struct TopChosen {
+       widestring title, shorttitle;
+       unsigned frequency;
+
+       bool operator< (const TopChosen &other) const;
+};
+
+/* A transactor that fetches the best N scores for a given tournament */
+class FetchTopChosenSongsForTournament : public pqxx::transactor<> {
+private:
+       unsigned tournament, num;
+       std::vector<TopChosen> *chosen;
+
+public:
+       FetchTopChosenSongsForTournament(unsigned tournament, unsigned num, std::vector<TopChosen> *chosen);
+       void operator() (pqxx::transaction<> &t);
+};
+
+#endif /* !defined(_FETCH_TOP_CHOSEN_SONGS_FOR_TOURNAMENT_H) */