From 6ad488f28bfd74c39be0c420a671b7c33f9250d6 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 23 Aug 2017 17:17:49 +0200 Subject: Name shortening independent from torunament source --- Aktywator/ParyTournament.cs | 2 +- Aktywator/RRBTournament.cs | 14 +------------- Aktywator/Tournament.cs | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'Aktywator') diff --git a/Aktywator/ParyTournament.cs b/Aktywator/ParyTournament.cs index f467119..4950c3d 100644 --- a/Aktywator/ParyTournament.cs +++ b/Aktywator/ParyTournament.cs @@ -31,7 +31,7 @@ namespace Aktywator override internal Dictionary> getNameList() { Dictionary> pairs = new Dictionary>(); - MySqlDataReader dbData = this.mysql.select("SELECT idp, CONCAT(SUBSTR(imie,1,1),'.',nazw) name FROM zawodnicy"); + MySqlDataReader dbData = this.mysql.select("SELECT idp, CONCAT(imie, ' ', nazw) name FROM zawodnicy"); while (dbData.Read()) { int pairNo = dbData.GetInt32(0); diff --git a/Aktywator/RRBTournament.cs b/Aktywator/RRBTournament.cs index 4c8f281..48040ee 100644 --- a/Aktywator/RRBTournament.cs +++ b/Aktywator/RRBTournament.cs @@ -62,19 +62,7 @@ namespace Aktywator names.Add(pairNo, new List()); foreach (XmlNode player in pair.SelectNodes("gracz/nazwisko")) { - if ("pauza".Equals(player.InnerText.Trim())) - { - names[pairNo].Add(" "); - } - else - { - string[] name = player.InnerText.Trim().Split(' '); - if (name.Length > 0) - { - name[0] = (name[0].Length > 0) ? name[0][0].ToString() : " "; - } - names[pairNo].Add(String.Join(" ", name)); - } + names[pairNo].Add(player.InnerText); } } diff --git a/Aktywator/Tournament.cs b/Aktywator/Tournament.cs index 85a2666..cbe9bf9 100644 --- a/Aktywator/Tournament.cs +++ b/Aktywator/Tournament.cs @@ -38,5 +38,21 @@ namespace Aktywator return new Dictionary>(); } + virtual internal string shortenNameToBWS(string name) + { + if ("pauza".Equals(name.Trim())) + { + return " "; + } + else + { + string[] nameParts = name.Trim().Split(' '); + if (nameParts.Length > 0) + { + nameParts[0] = (nameParts[0].Length > 0) ? nameParts[0][0].ToString() : " "; + } + return String.Join(" ", nameParts); + } + } } } -- cgit v1.2.3