From db4fda7a0869ab88162b6bba231e8ad6b94036bf Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 20 Mar 2018 20:49:14 +0100 Subject: Updating README known issues info --- Aktywator.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aktywator.txt b/Aktywator.txt index 28d1dce..3de7a1b 100644 --- a/Aktywator.txt +++ b/Aktywator.txt @@ -1,5 +1,5 @@ Known issues: -- nie działa zbieranie danych pośrednich (dane są zbierane w BWS, ale Kolektor Teamów ich nie czyta) +- nie działa zbieranie danych pośrednich, gdy wczytane są rozkłady (dane są zbierane w BWS, ale Kolektor Teamów ich nie czyta - potencjalny bug w Kolektorze) - nie działa update ustawienia maksowania każdego sektora w czasie sesji (samo maksowanie ustawione na początku sesji - działa) Aktywator 1.1.3 (beta) -- cgit v1.2.3 From 04ddfb636057d72381ce8c69c3ab81422b1d11a4 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 20 Mar 2018 20:52:41 +0100 Subject: Names for individual tournaments from JFR Pary Fixes #30 --- Aktywator/ParyTournament.cs | 33 +++++++++++++++++++++++++++++++-- Aktywator/Resources/BuildDate.txt | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Aktywator/ParyTournament.cs b/Aktywator/ParyTournament.cs index 0c9209f..2fdf360 100644 --- a/Aktywator/ParyTournament.cs +++ b/Aktywator/ParyTournament.cs @@ -2,20 +2,41 @@ using System.Collections.Generic; using System.Text; using MySql.Data.MySqlClient; +using System.Windows.Forms; namespace Aktywator { class ParyTournament: MySQLTournament { + private bool _indy = false; + public ParyTournament(string name, int type = Tournament.TYPE_PARY) : base(name, type) { this._type = Tournament.TYPE_PARY; + this._indy = this.isIndy(); } override internal string getTypeLabel() { - return "Pary"; + string label = "Pary"; + if (this._indy) + { + label += " (indywiduel)"; + MessageBox.Show( + "Nazwiska w turnieju indywidualnym są wyświetlane PARAMI, według rozstawienia w pierwszej rundzie.\n" + + "Używać TYLKO dla turniejów typu Finał GPPP ze stałym skojarzeniem par!", + "Nazwiska w turnieju indywidualnym", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + return label; + } + + private bool isIndy() + { + this.setup(); + bool pary; + Boolean.TryParse(this.mysql.selectOne("SELECT pary FROM admin;"), out pary); + return !pary; } override public string getSectionsNum() @@ -31,7 +52,15 @@ namespace Aktywator override internal Dictionary> getNameList() { Dictionary> pairs = new Dictionary>(); - MySqlDataReader dbData = this.mysql.select("SELECT idp, CONCAT(imie, ' ', nazw) name FROM zawodnicy ORDER BY idp"); + string query = this._indy ? + "SELECT pairs.pair, CONCAT(zawodnicy.imie, ' ', zawodnicy.nazw) name FROM ( " + + "SELECT zN player, zN pair, 0 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN UNION " + + "SELECT zS player, zN pair, 1 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN UNION " + + "SELECT zE player, zE pair, 0 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN UNION " + + "SELECT zW player, zE pair, 1 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN " + + ") pairs JOIN zawodnicy ON pairs.player = zawodnicy.id ORDER BY pairs.pair, pairs.in_pair;" : + "SELECT idp, CONCAT(imie, ' ', nazw) name FROM zawodnicy ORDER BY idp"; + MySqlDataReader dbData = this.mysql.select(query); while (dbData.Read()) { int pairNo = dbData.GetInt32(0); diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt index fb76437..c28b5ac 100644 --- a/Aktywator/Resources/BuildDate.txt +++ b/Aktywator/Resources/BuildDate.txt @@ -1 +1 @@ -2018-02-04 +2018-03-20 -- cgit v1.2.3 From f17c3f208995053a3594e1c5cb23be2ba48c474f Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 21 Mar 2018 17:05:16 +0100 Subject: Complete redesign of names loading mechanism. Fixes #24 --- Aktywator/Bws.cs | 219 ++++++++++++++++++++++++++++++++++---------------- Aktywator/MainForm.cs | 4 +- 2 files changed, 150 insertions(+), 73 deletions(-) diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index e589418..815e643 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -27,6 +27,13 @@ namespace Aktywator public bool analysis = false; } + class PairPosition + { + public int pairNo; + public int table; + public string position; + } + public Bws(string filename, MainForm main) { this._filename = filename; @@ -590,101 +597,171 @@ namespace Aktywator throw new InvalidCastException("Unable to read numeric value from BWS field"); } - public void syncNames(Tournament tournament, bool interactive, string startRounds, string section, DataGridView grid) + public void syncNames(Tournament tournament, bool interactive, string section, DataGridView grid) { int count = 0, countNew = 0, SKOK_STOLOW = Convert.ToInt32(main.numTeamsTableOffset.Value); - OleDbDataReader d; - startRounds = startRounds.Trim(); - string fromRound = sql.selectOne("SELECT min(`Round`) FROM RoundData WHERE NSPair>0"); - string sectionCondition = ""; - if (!("*".Equals(section))) + OleDbDataReader roundsReader = sql.select("SELECT `Section`, MIN(`Round`) FROM RoundData WHERE LowBoard > 0 GROUP BY `Section`;"); + Dictionary firstRounds = new Dictionary(); + while (roundsReader.Read()) + { + firstRounds.Add(this.getBWSNumber(roundsReader, 0), this.getBWSNumber(roundsReader, 1)); + } + roundsReader.Close(); + if (firstRounds.Count == 0) + { + MessageBox.Show("W BWSie nie ma danych rund!", "Brak danych", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + StringBuilder pairsQuery = new StringBuilder("SELECT `Section`, `Table`, NSPair, EWPair FROM RoundData WHERE ("); + List roundQueries = new List(); + foreach (KeyValuePair firstRound in firstRounds) + { + StringBuilder roundQuery = new StringBuilder("(`Round` = "); + roundQuery.Append(firstRound.Value); + roundQuery.Append(" AND `Section` = "); + roundQuery.Append(firstRound.Key); + roundQuery.Append(")"); + roundQueries.Add(roundQuery.ToString()); + } + pairsQuery.Append(String.Join(" OR ", roundQueries.ToArray())); + pairsQuery.Append(")"); + if (tournament.type == Tournament.TYPE_TEAMY) { - section = this.sectorLetterToNumber(section).ToString(); - sectionCondition = " AND `Section` = " + section; + pairsQuery.Append(" AND `Table` <= "); + pairsQuery.Append(SKOK_STOLOW); } - if (tournament.type != Tournament.TYPE_TEAMY) + pairsQuery.Append(";"); + + OleDbDataReader d; + d = sql.select(pairsQuery.ToString()); + + Dictionary> sectionPairs = new Dictionary>(); + Dictionary> pairs = new Dictionary>(); + while (d.Read()) { - if (tournament.type == Tournament.TYPE_PARY && startRounds.Length > 0) + int sectionNumber = this.getBWSNumber(d, 0); + int tableNumber = this.getBWSNumber(d, 1); + int nsPairNumber = this.getBWSNumber(d, 2); + int ewPairNumber = this.getBWSNumber(d, 3); + if (!sectionPairs.ContainsKey(sectionNumber)) { - d = sql.select("SELECT `Section`, `Table`, NSPair, EWPair FROM RoundData WHERE NSPair>0 AND `Round` in (" + startRounds + ")" + sectionCondition); + sectionPairs.Add(sectionNumber, new List()); } - else + sectionPairs[sectionNumber].Add(nsPairNumber); + sectionPairs[sectionNumber].Add(ewPairNumber); + if (!pairs.ContainsKey(sectionNumber)) { - d = sql.select("SELECT `Section`, `Table`, NSPair, EWPair FROM RoundData WHERE `Round`=" + fromRound + sectionCondition); + pairs.Add(sectionNumber, new List()); } + pairs[sectionNumber].Add(new PairPosition { pairNo = nsPairNumber, position = "NS", table = tableNumber }); + pairs[sectionNumber].Add(new PairPosition { pairNo = ewPairNumber, position = "EW", table = tableNumber }); } - else - { - d = sql.select("SELECT `Section`, `Table`, NSPair, EWPair FROM RoundData WHERE `Round`=" + fromRound + " AND `Table`<=" + SKOK_STOLOW + sectionCondition); - } + d.Close(); - try - { - Dictionary> names = tournament.getBWSNames(grid); + Dictionary> names = tournament.getBWSNames(grid); - while (d.Read()) + Dictionary> usedSections = new Dictionary>(); + List extraPairs = new List(); + foreach (KeyValuePair> pair in names) + { + bool foundInBWS = false; + foreach (KeyValuePair> pairsInSection in sectionPairs) { - string pairSection = "*".Equals(section) ? this.getBWSNumber(d, 0).ToString() : section; - string table = this.getBWSNumber(d, 1).ToString(); - int ns = this.getBWSNumber(d, 2); - int ew = this.getBWSNumber(d, 3); - - try + if (pairsInSection.Value.Contains(pair.Key)) { - if (!names.ContainsKey(ns)) + if (!usedSections.ContainsKey(pairsInSection.Key)) { - throw new KeyNotFoundException(ns.ToString()); - } - countNew += updateName(pairSection, table, "N", names[ns][0]); - countNew += updateName(pairSection, table, "S", names[ns][1]); - count += 2; - if (tournament.type == Tournament.TYPE_TEAMY) - { - countNew += updateName(pairSection, (int.Parse(table) + SKOK_STOLOW).ToString(), "E", - names.ContainsKey(ns + TeamNamesSettings.OpenClosedDiff) ? names[ns + TeamNamesSettings.OpenClosedDiff][0] : names[ns][0]); - countNew += updateName(pairSection, (int.Parse(table) + SKOK_STOLOW).ToString(), "W", - names.ContainsKey(ns + TeamNamesSettings.OpenClosedDiff) ? names[ns + TeamNamesSettings.OpenClosedDiff][1] : names[ns][1]); - count += 2; + usedSections.Add(pairsInSection.Key, new List()); } + usedSections[pairsInSection.Key].Add(pair.Key); + foundInBWS = true; } - catch (KeyNotFoundException keyE) - { - if (interactive) - { - DialogResult dr = MessageBox.Show("W bws-ie jest para/team (" + keyE.Message + ")" - + ", który nie istnieje w wybranym turnieju." - + "Może to nie ten turniej?" + "\n\n" + "Kontynuować wczytywanie?", - "Zły turniej", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if (dr == DialogResult.No) break; - } - } - try + } + if (!foundInBWS) { + extraPairs.Add(pair.Key); + } + } + + if (interactive) { + List warnings = new List(); + foreach (KeyValuePair> sectionData in sectionPairs) + { + if (this.sectorNumberToLetter(sectionData.Key).Equals(section) || "*".Equals(section)) { - if (!names.ContainsKey(ew)) + if (!usedSections.ContainsKey(sectionData.Key)) { - throw new KeyNotFoundException(ew.ToString()); + warnings.Add(" - w turnieju nie ma par dla sektora " + this.sectorNumberToLetter(sectionData.Key)); } - countNew += updateName(pairSection, table, "E", names[ew][0]); - countNew += updateName(pairSection, table, "W", names[ew][1]); - count += 2; - if (tournament.type == Tournament.TYPE_TEAMY) + else { - countNew += updateName(pairSection, (int.Parse(table) + SKOK_STOLOW).ToString(), "N", - names.ContainsKey(ns + TeamNamesSettings.OpenClosedDiff) ? names[ew + TeamNamesSettings.OpenClosedDiff][0] : names[ew][0]); - countNew += updateName(pairSection, (int.Parse(table) + SKOK_STOLOW).ToString(), "S", - names.ContainsKey(ns + TeamNamesSettings.OpenClosedDiff) ? names[ew + TeamNamesSettings.OpenClosedDiff][1] : names[ew][1]); - count += 2; + List missingPairs = new List(); + foreach (int pair in sectionData.Value) + { + if (!usedSections[sectionData.Key].Contains(pair)) + { + missingPairs.Add(pair); + } + } + if (missingPairs.Count > 0) + { + StringBuilder warning = new StringBuilder(" - w sektorze "); + warning.Append(this.sectorNumberToLetter(sectionData.Key)); + warning.Append(" brakuje "); + warning.Append(missingPairs.Count); + warning.Append(" par:"); + foreach (int pair in missingPairs) + { + warning.Append(' '); + warning.Append(pair); + } + warnings.Add(warning.ToString()); + } } } - catch (KeyNotFoundException keyE) + } + if (extraPairs.Count > 0) + { + StringBuilder warning = new StringBuilder(" - w BWS nie ma w ogóle "); + warning.Append(extraPairs.Count); + warning.Append(" par:"); + foreach (int pair in extraPairs) { - if (interactive) - { - DialogResult dr = MessageBox.Show("W bws-ie jest para/team (" + keyE.Message + ")" - + ", który nie istnieje w wybranym turnieju." - + "Może to nie ten turniej?" + "\n\n" + "Kontynuować wczytywanie?", - "Zły turniej", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if (dr == DialogResult.No) break; + warning.Append(' '); + warning.Append(pair); + } + warnings.Add(warning.ToString()); + } + + if (warnings.Count > 0) + { + DialogResult warningDialog = MessageBox.Show("Wykryto potencjalne problemy z wczytaniem nazwisk: \n\n" + String.Join("\n", warnings.ToArray()) + "\n\nCzy chcesz wczytać nazwiska mimo wszystko?", "Problemy z nazwiskami", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (warningDialog == DialogResult.No) + { + return; + } + } + } + + try + { + int sectionNumber = 0; + if (!"*".Equals(section)) { + sectionNumber = this.sectorLetterToNumber(section); + } + char[] seatMapping = { 'N', 'S', 'E', 'W' }; + foreach (KeyValuePair> sections in usedSections) { + if ("*".Equals(section) || sectionNumber == sections.Key) { + foreach (int pairNumber in sections.Value) { + PairPosition pair = pairs[sections.Key].Find(delegate(PairPosition p) { return p.pairNo == pairNumber; }); + for (int i = 0; i < names[pair.pairNo].Count; i++) { + countNew += this.updateName(sections.Key.ToString(), pair.table.ToString(), pair.position[i].ToString(), names[pair.pairNo][i]); + if (tournament.type == Tournament.TYPE_TEAMY) + { + char otherTableSeat = seatMapping[(Array.IndexOf(seatMapping, pair.position[i]) + 2) % 4]; + countNew += this.updateName(sections.Key.ToString(), (pair.table + SKOK_STOLOW).ToString(), otherTableSeat.ToString(), names[pair.pairNo][i]); + } + } + count += names[pair.pairNo].Count * ((tournament.type == Tournament.TYPE_TEAMY) ? 2 : 1); } } } diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index bb6a45e..e0ecc29 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -450,7 +450,7 @@ namespace Aktywator { try { - bws.syncNames(tournament, true, eOomRounds.Text, cbNamesSection.SelectedItem.ToString(), namesGridView); + bws.syncNames(tournament, true, cbNamesSection.SelectedItem.ToString(), namesGridView); } catch (Exception ee) { @@ -505,7 +505,7 @@ namespace Aktywator private void timer_Tick(object sender, EventArgs e) { - bws.syncNames(tournament, false, eOomRounds.Text, cbNamesSection.SelectedItem.ToString(), namesGridView); + bws.syncNames(tournament, false, cbNamesSection.SelectedItem.ToString(), namesGridView); } private void bForceSync_Click(object sender, EventArgs e) -- cgit v1.2.3 From 05731124e0b88765c79c894e0d67d80c689cff78 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 21 Mar 2018 17:06:18 +0100 Subject: "OOM rounds" fields is no longer necessary --- Aktywator/MainForm.Designer.cs | 41 ----------------------------------------- Aktywator/MainForm.cs | 6 ------ Aktywator/MainForm.resx | 4 ++-- 3 files changed, 2 insertions(+), 49 deletions(-) diff --git a/Aktywator/MainForm.Designer.cs b/Aktywator/MainForm.Designer.cs index 7485e01..f8b03b9 100644 --- a/Aktywator/MainForm.Designer.cs +++ b/Aktywator/MainForm.Designer.cs @@ -90,9 +90,6 @@ this.xResultsOverview = new System.Windows.Forms.ComboBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.sectionToolStrip = new System.Windows.Forms.ToolStrip(); - this.eOomRounds = new System.Windows.Forms.ToolStripTextBox(); - this.lOomLabel = new System.Windows.Forms.ToolStripLabel(); - this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.cbNamesSection = new System.Windows.Forms.ToolStripComboBox(); this.namesPanel = new System.Windows.Forms.Panel(); @@ -802,9 +799,6 @@ this.sectionToolStrip.GripMargin = new System.Windows.Forms.Padding(0); this.sectionToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.sectionToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.eOomRounds, - this.lOomLabel, - this.toolStripButton2, this.toolStripLabel1, this.cbNamesSection}); this.sectionToolStrip.Location = new System.Drawing.Point(3, 458); @@ -813,38 +807,6 @@ this.sectionToolStrip.TabIndex = 30; this.sectionToolStrip.Text = "toolStrip5"; // - // eOomRounds - // - this.eOomRounds.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.eOomRounds.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.eOomRounds.Enabled = false; - this.eOomRounds.Name = "eOomRounds"; - this.eOomRounds.Size = new System.Drawing.Size(80, 25); - this.eOomRounds.ToolTipText = "Jeśli nie wiesz do czego to jest, to nic nie wpisuj!"; - // - // lOomLabel - // - this.lOomLabel.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.lOomLabel.Enabled = false; - this.lOomLabel.Name = "lOomLabel"; - this.lOomLabel.Size = new System.Drawing.Size(92, 22); - this.lOomLabel.Text = "Rundy dla OOM"; - this.lOomLabel.ToolTipText = "Jeśli nie wiesz do czego to jest, to nic nie wpisuj!"; - // - // toolStripButton2 - // - this.toolStripButton2.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.toolStripButton2.BackColor = System.Drawing.Color.Transparent; - this.toolStripButton2.CheckOnClick = true; - this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripButton2.Name = "toolStripButton2"; - this.toolStripButton2.Size = new System.Drawing.Size(23, 22); - this.toolStripButton2.Text = "‎✔"; - this.toolStripButton2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.toolStripButton2.ToolTipText = "Jeśli nie wiesz do czego to jest, to nic nie wpisuj!"; - this.toolStripButton2.CheckedChanged += new System.EventHandler(this.toolStripButton2_CheckedChanged); - // // toolStripLabel1 // this.toolStripLabel1.Name = "toolStripLabel1"; @@ -1620,9 +1582,6 @@ private System.Windows.Forms.ToolStripButton bTruncate; private System.Windows.Forms.ToolStripButton bAutoSync; private System.Windows.Forms.ToolStripTextBox eInterval; - private System.Windows.Forms.ToolStripTextBox eOomRounds; - private System.Windows.Forms.ToolStripLabel lOomLabel; - private System.Windows.Forms.ToolStripButton toolStripButton2; private System.Windows.Forms.DataGridView namesGridView; private System.Windows.Forms.Panel namesPanel; public System.Windows.Forms.NumericUpDown numTeamsTableOffset; diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index e0ecc29..1e418fd 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -580,12 +580,6 @@ namespace Aktywator toolStripSplitButton1.ShowDropDown(); } - private void toolStripButton2_CheckedChanged(object sender, EventArgs e) - { - eOomRounds.Enabled = toolStripButton2.Checked; - lOomLabel.Enabled = toolStripButton2.Checked; - } - private void namesGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > 0) diff --git a/Aktywator/MainForm.resx b/Aktywator/MainForm.resx index a60549f..11af55c 100644 --- a/Aktywator/MainForm.resx +++ b/Aktywator/MainForm.resx @@ -340,7 +340,7 @@ S5vmPfe+JjvtcklE6MUrYYEbmdtDfF9ayn2gKP5L/6d/QueutWjblIOunWvQezgfd/74BmoPvHwuwN7e mZGPOdVz5pg0Lc/JVm/IvXF77xZ0bl6BusRpOOPujCXm7LNiXd1EkhkPir9vUQU/VBS2aV7bhaaceWhe ngT1moVo35yDzh2r0bV7Le6/9hLUeXn/3D5j+ubBTmOEMjqaV580N7/zxRd77r1zEANv5KNx8XycdZUj - 1dj4Y1MWawbJBENqImHqVP8jeXnfd+Q9T8bPQevqDKjXZ6Ej7wV07d0Izf48dB/Yju7929D/yhbg8E7c + 1dj4Y1MWawbJBENqImHqVP/DeXnfd+Q9T8bPQevqDKjXZ6Ej7wV07d0Izf48dB/Yju7929D/yhbg8E7c WLpIESgSeTNDjBoNqQs2t6xf33/33SN4+OGb6MjfiOuTw5FnafmVLUtnIUlsh5Q/4ui2LTvxwZtQ06q3 r8uEekM22retJONfRDftSPeRPeg5mo/eQ7vQSxPppUn8q2AD7mxcgY2hwauZYf4vVFlZz6lXvaDsO7QH D/6wHwPv7MetFYtwQiodiNLTe5kkHtQMB8U/hc1m895cmHK1acsaaDYvg2bHKmho5btf24meY/vQe+wV @@ -383,7 +383,7 @@ imXm5oeYS8Mz0czM8UFGIno2ZKI9Zy5aUmKhSgjBLcpE9REUyMFy7OXzS0k6bMU5Ghx1dy47zuXWMF8f jZppE2sGctPRuTKFiYNwNMb44FaUC65RdggzNP7ff22OIZZ6eh5xpqbaU/nRM95kC4v49vgo9K5JG3yF rp4/Gc0JwSgNdUe+wLqKJE5Dyl+Nx3/9uJTDKWicEoKOhXF0HkSjMsoPb/D5fVa6uvGM5OknwdB42wlb - 287TlJO3WnNvWOrozKXLVKL8htBnsdwoD2tLBq3bjMnJ+zu/fVisfwMVwMtUf+V6egAAAABJRU5ErkJg + 287TlJO3WnNvWOrozKXLVKL8htBnsdwoD2tLBq3bjMnJ+zu/fVisfwP1S8tTgtT67QAAAABJRU5ErkJg gg== -- cgit v1.2.3 From f8fa8c47077c25c56cf245e8d974613db4459ff6 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 21 Mar 2018 17:11:57 +0100 Subject: Version number bumped to 1.1.4 --- Aktywator.txt | 9 +++++++++ Aktywator/Properties/AssemblyInfo.cs | 4 ++-- Aktywator/Resources/BuildDate.txt | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Aktywator.txt b/Aktywator.txt index 3de7a1b..ed4e14d 100644 --- a/Aktywator.txt +++ b/Aktywator.txt @@ -2,6 +2,15 @@ - nie działa zbieranie danych pośrednich, gdy wczytane są rozkłady (dane są zbierane w BWS, ale Kolektor Teamów ich nie czyta - potencjalny bug w Kolektorze) - nie działa update ustawienia maksowania każdego sektora w czasie sesji (samo maksowanie ustawione na początku sesji - działa) +Aktywator 1.1.4 (beta) +??.??.???? [mkl] + * wczytywanie nazwisk do indywiduela granego parami + * usprawnienie mechanizmu wczytywania nazwisk do różnych sektorów + * usprawnienie mechanizmu ostrzegania o problemach przy wczytywaniu nazwisk + * poprawki sortowania listy nazwisk + * poprawki wczytywania rozkładów + +--------------------- Aktywator 1.1.3 (beta) 04.01.2018 [mkl] * niewymuszanie odświeżania listy nazwisk po wczytaniu turnieju diff --git a/Aktywator/Properties/AssemblyInfo.cs b/Aktywator/Properties/AssemblyInfo.cs index e31f26d..9f3f39f 100644 --- a/Aktywator/Properties/AssemblyInfo.cs +++ b/Aktywator/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")] +[assembly: AssemblyVersion("1.1.4.0")] +[assembly: AssemblyFileVersion("1.1.4.0")] diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt index c28b5ac..528d3c6 100644 --- a/Aktywator/Resources/BuildDate.txt +++ b/Aktywator/Resources/BuildDate.txt @@ -1 +1 @@ -2018-03-20 +2018-03-21 -- cgit v1.2.3 From d9a9ced98db04759739eebb6b07361670f097eaa Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 16:51:14 +0200 Subject: Some of the initialization procedures for BWS might need a valid reference to Bws() --- Aktywator/Bws.cs | 4 ++++ Aktywator/MainForm.cs | 1 + 2 files changed, 5 insertions(+) diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 815e643..1af237f 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -39,6 +39,10 @@ namespace Aktywator this._filename = filename; sql = new Sql(filename); this.main = main; + } + + public void init() + { string[] sections = this.getSections().Split(','); this.displaySectionBoardsInfo(sections); } diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 1e418fd..511db11 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -65,6 +65,7 @@ namespace Aktywator } bws = new Bws(filename, this); + bws.init(); bws.convert(); labelFilename.Text = filename; -- cgit v1.2.3 From 7b2f2c9e74a0e00f1fb12cba23fb218e470998eb Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 16:55:18 +0200 Subject: Section group setting saved in a uniform way --- Aktywator/Bws.cs | 10 +--------- Aktywator/Setting.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 1af237f..5695a00 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -552,15 +552,7 @@ namespace Aktywator Setting.save("BM2NameSource", "2", this, errors, section); Setting.save("BM2PINcode", "'" + main.xPINcode.Text + "'", this, errors, section); Setting.save("BM2ResultsOverview", main.xResultsOverview.SelectedIndex.ToString(), this, errors, section); - if (main.xGroupSections.Checked) - { - sql.query("UPDATE Tables SET `Group` = 1;"); - } - else - { - sql.query("UPDATE Tables SET `Group` = `Section`;"); - } - + Setting.saveSectionGroups(this.sql, main.xGroupSections.Checked); this.loadSettings(); } diff --git a/Aktywator/Setting.cs b/Aktywator/Setting.cs index 613065f..bde6fd1 100644 --- a/Aktywator/Setting.cs +++ b/Aktywator/Setting.cs @@ -170,5 +170,13 @@ namespace Aktywator { } } + + public static void saveSectionGroups(Sql sql, bool value) + { + StringBuilder sb = new StringBuilder("UPDATE Tables SET `Group` = "); + sb.Append(value ? "1" : "`Section`"); + sb.Append(";"); + sql.query(sb.ToString()); + } } } -- cgit v1.2.3 From bc1eb7582b69794bc519a086a306bcf9e9bd6a9c Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 16:56:44 +0200 Subject: Detecting different hand records between sections --- Aktywator/Bws.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 5695a00..19a2463 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -841,6 +841,7 @@ namespace Aktywator { sql.query("DELETE FROM HandRecord WHERE `Section` = " + section); sql.query("DELETE FROM HandEvaluation WHERE `Section` = " + section); + this._differentRecordsDetected = false; } public void clearHandRecords() @@ -922,6 +923,30 @@ namespace Aktywator return count; } + private bool _differentRecordsDetected = false; + private bool _differentRecordsInSections = false; + + public bool detectDifferentRecordsInSections() + { + if (!this._differentRecordsDetected) + { + this._differentRecordsInSections = false; + OleDbDataReader sections = sql.select("SELECT DISTINCT COUNT(`Section`) FROM HandRecord GROUP BY Board, NorthSpades, NorthHearts, NorthDiamonds, NorthClubs, EastSpades, EastHearts, EastDiamonds, EastClubs, SouthSpades, SouthHearts, SouthDiamonds, SouthClubs"); + while (sections.Read()) + { + int boardSections = this.getBWSNumber(sections, 0); + int bwsSections = main.gwSections.Rows.Count; + if (boardSections != bwsSections) + { + this._differentRecordsInSections = true; + break; + } + } + this._differentRecordsDetected = true; + } + return this._differentRecordsInSections; + } + internal string getMySQLDatabaseForSection() { try -- cgit v1.2.3 From 59a523137b5a8dccee77c23493b34b8862532992 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 16:58:20 +0200 Subject: Two possible warning messages for sections grouping setting warning --- Aktywator/MainForm.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 511db11..d2cb88b 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -321,6 +321,9 @@ namespace Aktywator bws.loadSettings(); } + static public string sectionGroupWarningLabel = "Opcja grupowania zapisów w sektorach (albo osobnego maksowania sektorów) nie może być zaktualizowana w trakcie trwania sesji!"; + static public string differentRecordsInSections = "BWS zawiera różne rozkłady w różnych sektorach, opcja grupowania sektorów musi być wyłączona."; + private void xShowResults_CheckedChanged(object sender, EventArgs e) { if (xShowResults.Checked) @@ -632,7 +635,8 @@ namespace Aktywator private void lGroupSectionsWarning_Click(object sender, EventArgs e) { - MessageBox.Show("Opcja grupowania zapisów w sektorach (albo osobnego maksowania sektorów) nie może być zaktualizowana w trakcie trwania sesji!", "Ustawienia grupowania zapisów w sektorach", MessageBoxButtons.OK, MessageBoxIcon.Question); + string message = bws.detectDifferentRecordsInSections() ? MainForm.differentRecordsInSections : MainForm.sectionGroupWarningLabel; + MessageBox.Show(message, "Ustawienia grupowania zapisów w sektorach", MessageBoxButtons.OK, MessageBoxIcon.Question); } private void bTeamsNamesSettings_Click(object sender, EventArgs e) -- cgit v1.2.3 From 5ae44afb4d3e63c9a7020689ffe3a2f14a5cc669 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 16:59:21 +0200 Subject: Showing warning in settings panel if there are different hand records in multiple sections --- Aktywator/MainForm.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index d2cb88b..96b66a7 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -324,14 +324,14 @@ namespace Aktywator static public string sectionGroupWarningLabel = "Opcja grupowania zapisów w sektorach (albo osobnego maksowania sektorów) nie może być zaktualizowana w trakcie trwania sesji!"; static public string differentRecordsInSections = "BWS zawiera różne rozkłady w różnych sektorach, opcja grupowania sektorów musi być wyłączona."; - private void xShowResults_CheckedChanged(object sender, EventArgs e) + public void xShowResults_CheckedChanged(object sender, EventArgs e) { if (xShowResults.Checked) { xRepeatResults.Enabled = true; xShowPercentage.Enabled = true; xResultsOverview.Enabled = true; - xGroupSections.Enabled = true; + xGroupSections.Enabled = !bws.detectDifferentRecordsInSections(); } else { @@ -341,7 +341,7 @@ namespace Aktywator xResultsOverview.Enabled = false; xGroupSections.Enabled = false; } - if (cbSettingsSection.Items.Count > 2) + if (cbSettingsSection.Items.Count > 2 || bws.detectDifferentRecordsInSections()) { bws.sectionGroupWarning(); } -- cgit v1.2.3 From 31c37824034320c4f87c91e1bf6d6e0c98e26524 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 17:03:57 +0200 Subject: Disabling section group option if there's only one section --- Aktywator/MainForm.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 96b66a7..6284419 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -345,6 +345,10 @@ namespace Aktywator { bws.sectionGroupWarning(); } + if (cbSettingsSection.Items.Count <= 2) + { + xGroupSections.Enabled = false; + } } private void xMemberNumbers_CheckedChanged(object sender, EventArgs e) -- cgit v1.2.3 From 252f77a86f9d70800e7cc9aa58de2557fba5fdaa Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 17:05:46 +0200 Subject: Forcing section group settings and a warning if different records are uploaded to sections Fixes #42 --- Aktywator/Bws.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 19a2463..15219f9 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -119,6 +119,16 @@ namespace Aktywator this.setHandRecordInfo(board.Key); } } + main.xShowResults_CheckedChanged(null, EventArgs.Empty); + if (this.detectDifferentRecordsInSections()) + { + if (main.xGroupSections.Checked) + { + MessageBox.Show(MainForm.differentRecordsInSections, "Ustawienia grupowania zapisów w sektorach", MessageBoxButtons.OK, MessageBoxIcon.Warning); + main.xGroupSections.Checked = false; + } + Setting.saveSectionGroups(this.sql, main.xGroupSections.Checked); + } } private void setHandRecordInfo(int board, string section = null, List layout = null, bool analysis = false) @@ -514,7 +524,7 @@ namespace Aktywator public void sectionGroupWarning() { main.lGroupSectionsWarning.Visible = false; - if (main.xShowResults.Checked) + if (main.xShowResults.Checked || this.detectDifferentRecordsInSections()) { main.lGroupSectionsWarning.Visible = true; } -- cgit v1.2.3 From 40fd243fcbf38cb4bddf9337b2d8be5165dd3b22 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 17:07:24 +0200 Subject: Bumping version number --- Aktywator/Properties/AssemblyInfo.cs | 4 ++-- Aktywator/Resources/BuildDate.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Aktywator/Properties/AssemblyInfo.cs b/Aktywator/Properties/AssemblyInfo.cs index 9f3f39f..90362f9 100644 --- a/Aktywator/Properties/AssemblyInfo.cs +++ b/Aktywator/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.4.0")] -[assembly: AssemblyFileVersion("1.1.4.0")] +[assembly: AssemblyVersion("1.1.4.1")] +[assembly: AssemblyFileVersion("1.1.4.1")] diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt index 528d3c6..777043e 100644 --- a/Aktywator/Resources/BuildDate.txt +++ b/Aktywator/Resources/BuildDate.txt @@ -1 +1 @@ -2018-03-21 +2018-04-13 -- cgit v1.2.3 From 914aacc61a1297786dc8c59a092674b023bf5180 Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 15 Apr 2018 11:16:38 +0200 Subject: BWS structure for hand records needs to be checked and created earlier on. --- Aktywator/Bws.cs | 45 ++++++++++++++++++++++----------------- Aktywator/Resources/BuildDate.txt | 2 +- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 15219f9..9121eb1 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -390,13 +390,14 @@ namespace Aktywator { } + this._ensureHandRecordStructure(); + try { - sql.query("CREATE TABLE HandRecord (`Section` integer, `Board` integer, " - + "NorthSpades text(13),NorthHearts text(13),NorthDiamonds text(13),NorthClubs text(13)," - + "EastSpades text(13),EastHearts text(13),EastDiamonds text(13),EastClubs text(13)," - + "SouthSpades text(13),SouthHearts text(13),SouthDiamonds text(13),SouthClubs text(13)," - + "WestSpades text(13),WestHearts text(13),WestDiamonds text(13),WestClubs text(13)" + sql.query("CREATE TABLE PlayData (" + + "`ID` autoincrement, `Section` integer, `Table` integer, `Round` integer, `Board` integer," + + "`Counter` integer, `Direction` text(2), `Card` text(10), `DateLog` datetime," + + "`TimeLog` datetime, `Erased` bit" + ");"); } catch (OleDbException) @@ -404,23 +405,26 @@ namespace Aktywator } try { - sql.query("CREATE TABLE HandEvaluation (`Section` integer, `Board` integer, " - + "NorthSpades integer,NorthHearts integer,NorthDiamonds integer,NorthClubs integer,NorthNotrump integer," - + "EastSpades integer,EastHearts integer,EastDiamonds integer,EastClubs integer,EastNotrump integer," - + "SouthSpades integer,SouthHearts integer,SouthDiamonds integer,SouthClubs integer,SouthNotrump integer," - + "WestSpades integer,WestHearts integer,WestDiamonds integer,WestClubs integer,WestNotrump integer," - + "NorthHcp integer,EastHcp integer,SouthHcp integer,WestHcp integer" + sql.query("CREATE TABLE BiddingData (" + + "`ID` autoincrement, `Section` integer, `Table` integer, `Round` integer, `Board` integer," + + "`Counter` integer, `Direction` text(2), `Bid` text(10), `DateLog` datetime," + + "`TimeLog` datetime, `Erased` bit" + ");"); } catch (OleDbException) { } + } + + private void _ensureHandRecordStructure() + { try { - sql.query("CREATE TABLE PlayData (" - + "`ID` autoincrement, `Section` integer, `Table` integer, `Round` integer, `Board` integer," - + "`Counter` integer, `Direction` text(2), `Card` text(10), `DateLog` datetime," - + "`TimeLog` datetime, `Erased` bit" + sql.query("CREATE TABLE HandRecord (`Section` integer, `Board` integer, " + + "NorthSpades text(13),NorthHearts text(13),NorthDiamonds text(13),NorthClubs text(13)," + + "EastSpades text(13),EastHearts text(13),EastDiamonds text(13),EastClubs text(13)," + + "SouthSpades text(13),SouthHearts text(13),SouthDiamonds text(13),SouthClubs text(13)," + + "WestSpades text(13),WestHearts text(13),WestDiamonds text(13),WestClubs text(13)" + ");"); } catch (OleDbException) @@ -428,10 +432,12 @@ namespace Aktywator } try { - sql.query("CREATE TABLE BiddingData (" - + "`ID` autoincrement, `Section` integer, `Table` integer, `Round` integer, `Board` integer," - + "`Counter` integer, `Direction` text(2), `Bid` text(10), `DateLog` datetime," - + "`TimeLog` datetime, `Erased` bit" + sql.query("CREATE TABLE HandEvaluation (`Section` integer, `Board` integer, " + + "NorthSpades integer,NorthHearts integer,NorthDiamonds integer,NorthClubs integer,NorthNotrump integer," + + "EastSpades integer,EastHearts integer,EastDiamonds integer,EastClubs integer,EastNotrump integer," + + "SouthSpades integer,SouthHearts integer,SouthDiamonds integer,SouthClubs integer,SouthNotrump integer," + + "WestSpades integer,WestHearts integer,WestDiamonds integer,WestClubs integer,WestNotrump integer," + + "NorthHcp integer,EastHcp integer,SouthHcp integer,WestHcp integer" + ");"); } catch (OleDbException) @@ -938,6 +944,7 @@ namespace Aktywator public bool detectDifferentRecordsInSections() { + this._ensureHandRecordStructure(); if (!this._differentRecordsDetected) { this._differentRecordsInSections = false; diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt index 777043e..c370c3b 100644 --- a/Aktywator/Resources/BuildDate.txt +++ b/Aktywator/Resources/BuildDate.txt @@ -1 +1 @@ -2018-04-13 +2018-04-15 -- cgit v1.2.3 From e6b05c1de6ff45e012d986b721bbbdfb11f3ee37 Mon Sep 17 00:00:00 2001 From: Michał Zimniewicz Date: Fri, 5 Oct 2018 15:41:58 +0200 Subject: Update Aktywator.txt for version 1.1.4 --- Aktywator.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Aktywator.txt b/Aktywator.txt index ed4e14d..82896cb 100644 --- a/Aktywator.txt +++ b/Aktywator.txt @@ -3,12 +3,13 @@ - nie działa update ustawienia maksowania każdego sektora w czasie sesji (samo maksowanie ustawione na początku sesji - działa) Aktywator 1.1.4 (beta) -??.??.???? [mkl] +05.10.2018 [mkl] * wczytywanie nazwisk do indywiduela granego parami * usprawnienie mechanizmu wczytywania nazwisk do różnych sektorów * usprawnienie mechanizmu ostrzegania o problemach przy wczytywaniu nazwisk * poprawki sortowania listy nazwisk * poprawki wczytywania rozkładów + * dodany plik licencji do wersji binarnej wraz z odpowiednimi informacjami o licencjach zależności --------------------- Aktywator 1.1.3 (beta) -- cgit v1.2.3