summaryrefslogtreecommitdiff
path: root/Aktywator
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-09-19 19:27:17 +0200
committeremkael <emkael@tlen.pl>2017-09-19 19:27:17 +0200
commit2c40aed6e5dd3913d10c656c47932938632f26c4 (patch)
tree1dd35c6ff826928c8428413ed8eaa79e2274c706 /Aktywator
parente680df19bef06dc3a1e1015577b4091f4d2a360f (diff)
Fetching current and overall round/segment info for Teamy tournaments
Diffstat (limited to 'Aktywator')
-rw-r--r--Aktywator/TeamyTournament.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/Aktywator/TeamyTournament.cs b/Aktywator/TeamyTournament.cs
index 78ce0e0..bd6b619 100644
--- a/Aktywator/TeamyTournament.cs
+++ b/Aktywator/TeamyTournament.cs
@@ -43,5 +43,44 @@ namespace Aktywator
return teams;
}
+ private int rounds = 0;
+ internal int getRoundsNum()
+ {
+ if (this.rounds == 0)
+ {
+ this.rounds = Int32.Parse(this.mysql.selectOne("SELECT roundcnt FROM admin"));
+ }
+ return this.rounds;
+ }
+
+ private int segments = 0;
+ internal int getSegmentsNum()
+ {
+ if (this.segments == 0)
+ {
+ this.segments = Int32.Parse(this.mysql.selectOne("SELECT segmentsperround FROM admin"));
+ }
+ return this.segments;
+ }
+
+ internal List<int> getCurrentSegment()
+ {
+ MySqlDataReader finished = this.mysql.select("SELECT rnd, segm FROM admin");
+ List<int> segment = new List<int>();
+ finished.Read();
+ segment.Add(finished.GetInt32(0));
+ segment.Add(finished.GetInt32(1));
+ segment[1]++;
+ if (segment[1] > this.getSegmentsNum()) {
+ segment[0]++;
+ if (segment[0] > this.getRoundsNum())
+ {
+ segment[0] = this.getRoundsNum();
+ segment[1] = this.getSegmentsNum();
+ }
+ }
+ finished.Close();
+ return segment;
+ }
}
}