EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル
修訂 | 61f5ff9bd36a871fd9fca272c05952ca02553c1b (tree) |
---|---|
時間 | 2021-06-27 05:07:21 |
作者 | yoshy <yoshy@user...> |
Commiter | yoshy |
temp_20210627_0507
@@ -55,6 +55,10 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
55 | 55 | |
56 | 56 | CourseName = TurfDirtName + Race?.Kyori; |
57 | 57 | |
58 | + TrackShapeName = CodeHelper.GetInstance().GetTrackShapeName(Race?.Trackcd, "不明"); | |
59 | + | |
60 | + bool isFlatRace = Race?.Trackcd.CompareTo("50") < 0; | |
61 | + | |
58 | 62 | TosuFormatted = FormatHelper.FormatTosu(Race); |
59 | 63 | |
60 | 64 | BabaJyotaiFormatted = FormatHelper.FormatBabaJyotai(Race); |
@@ -67,29 +71,52 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
67 | 71 | |
68 | 72 | Kimete = CodeHelper.GetInstance().GetName(CodeHelper.KYAKUSITU_KUBUN, Kyakusitukubun, "不明"); |
69 | 73 | |
70 | - PCIRatioFormatted = FormatHelper.FormatPCIRatio(Harontimel3, Stat?.Harontimel3Avg, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
74 | + if (isFlatRace) | |
75 | + { | |
76 | + PCIRatioFormatted = FormatHelper.FormatPCIRatio(Harontimel3, Stat?.Harontimel3Avg, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
71 | 77 | |
72 | - HaronTimeL3Formatted = FormatHelper.FormatTimeSSF(Harontimel3); | |
78 | + HaronTimeL3Formatted = FormatHelper.FormatTimeSSF(Harontimel3); | |
73 | 79 | |
74 | - HaronTimeL3DevFormatted = FormatHelper.FormatHaronTimeL3Dev(Harontimel3, Stat?.Harontimel3Avg, Stat?.Harontimel3Dev); | |
80 | + HaronTimeL3DevFormatted = FormatHelper.FormatHaronTimeL3Dev(Harontimel3, Stat?.Harontimel3Avg, Stat?.Harontimel3Dev); | |
75 | 81 | |
76 | - PCIFormatted = FormatHelper.FormatPCI(Harontimel3, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
82 | + PCIFormatted = FormatHelper.FormatPCI(Harontimel3, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
77 | 83 | |
78 | - AvgHaronTimeMinus3Formatted = FormatHelper.FormatAvgHaronTimeMinus3(Time, Harontimel3, Race?.Kyori); | |
84 | + AvgHaronTimeMinus3Formatted = FormatHelper.FormatAvgHaronTimeMinus3(Time, Harontimel3, Race?.Kyori); | |
79 | 85 | |
80 | - AvgHaronTimeMinus3DevFormatted = FormatHelper.FormatAvgHaronTimeMinus3Dev(Time, Harontimel3, Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
86 | + AvgHaronTimeMinus3DevFormatted = FormatHelper.FormatAvgHaronTimeMinus3Dev(Time, Harontimel3, Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
81 | 87 | |
82 | - TimeFormatted = FormatHelper.FormatTimeMSSF(Time); | |
88 | + StatPCIFormatted = FormatHelper.FormatPCI(Stat?.Harontimel3Avg, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
83 | 89 | |
84 | - FutanFormatted = FormatHelper.ToNumber(Futan, 3, 1); | |
90 | + StatHaronTimeL3Formatted = FormatHelper.FormatTimeSSF(Stat?.Harontimel3Avg); | |
85 | 91 | |
86 | - BataijyuFormatted = FormatHelper.FormatBataijyu(Bataijyu, Zogenfugo, Zogensa); | |
92 | + StatAvgHaronTimeMinus3Formatted = FormatHelper.FormatTimeSSF(Stat?.Avgharontimeminus3Avg); | |
93 | + } | |
94 | + else | |
95 | + { | |
96 | + PCIRatioFormatted = FormatHelper.NODATA; | |
97 | + | |
98 | + HaronTimeL3Formatted = FormatHelper.NODATA; | |
99 | + | |
100 | + HaronTimeL3DevFormatted = FormatHelper.NODATA; | |
101 | + | |
102 | + PCIFormatted = FormatHelper.NODATA; | |
103 | + | |
104 | + AvgHaronTimeMinus3Formatted = FormatHelper.FormatAvgHaronTime3(Time, Race?.Kyori); | |
87 | 105 | |
88 | - StatPCIFormatted = FormatHelper.FormatPCI(Stat?.Harontimel3Avg, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
106 | + AvgHaronTimeMinus3DevFormatted = FormatHelper.FormatAvgHaronTime3Dev(Time, Race?.Kyori, Stat?.Avgharontimeminus3Avg, Stat?.Avgharontimeminus3Dev); | |
89 | 107 | |
90 | - StatHaronTimeL3Formatted = FormatHelper.FormatTimeSSF(Stat?.Harontimel3Avg); | |
108 | + StatPCIFormatted = FormatHelper.NODATA; | |
91 | 109 | |
92 | - StatAvgHaronTimeMinus3Formatted = FormatHelper.FormatTimeSSF(Stat?.Avgharontimeminus3Avg); | |
110 | + StatHaronTimeL3Formatted = FormatHelper.NODATA; | |
111 | + | |
112 | + StatAvgHaronTimeMinus3Formatted = FormatHelper.FormatTimeSSF(Stat?.Avgharontimeminus3Avg); | |
113 | + } | |
114 | + | |
115 | + TimeFormatted = FormatHelper.FormatTimeMSSF(Time); | |
116 | + | |
117 | + FutanFormatted = FormatHelper.ToNumber(Futan, 3, 1); | |
118 | + | |
119 | + BataijyuFormatted = FormatHelper.FormatBataijyu(Bataijyu, Zogenfugo, Zogensa); | |
93 | 120 | } |
94 | 121 | |
95 | 122 | public string YearMonthDay { get; private set; } |
@@ -108,6 +135,8 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
108 | 135 | |
109 | 136 | public string CourseName { get; private set; } |
110 | 137 | |
138 | + public string TrackShapeName { get; private set; } | |
139 | + | |
111 | 140 | public string TosuFormatted { get; private set; } |
112 | 141 | |
113 | 142 | public string BabaJyotaiFormatted { get; private set; } |
@@ -8,7 +8,7 @@ using UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2; | ||
8 | 8 | |
9 | 9 | namespace UmaTest.App.Domain.Model.Repository.Database.Dto |
10 | 10 | { |
11 | - public class UmaRaceStat : AppUmaRaceStddev | |
11 | + public class UmaRaceStat : AppUmaRaceStat | |
12 | 12 | { |
13 | 13 | [Ignore] |
14 | 14 | public string Key => $"{Jyocd}-{Kyori}-{Trackcd}-{Gradecd}-{Syubetucd}-{Kaishudate}"; |
@@ -34,11 +34,11 @@ namespace UmaTest.App.Domain.Model.Repository.Database.Entity.EveryDB2 | ||
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - [TableName("\"public\".\"app_uma_race_stddev\"")] | |
37 | + [TableName("\"public\".\"app_uma_race_stat\"")] | |
38 | 38 | [PrimaryKey("kaishudate", AutoIncrement = false)] |
39 | 39 | [ExplicitColumns] |
40 | - public partial class AppUmaRaceStddev | |
41 | - : Record<AppUmaRaceStddev> | |
40 | + public partial class AppUmaRaceStat | |
41 | + : Record<AppUmaRaceStat> | |
42 | 42 | { |
43 | 43 | [Column(Name = "jyocd")] |
44 | 44 | public string Jyocd |
@@ -562,6 +562,11 @@ namespace UmaTest.App.Presentation.View | ||
562 | 562 | }, |
563 | 563 | new DataGridViewTextBoxColumn |
564 | 564 | { |
565 | + DataPropertyName = "TrackShapeName", | |
566 | + Name = "形状", | |
567 | + }, | |
568 | + new DataGridViewTextBoxColumn | |
569 | + { | |
565 | 570 | DataPropertyName = "GradeName", |
566 | 571 | Name = "G", |
567 | 572 | }, |
@@ -704,6 +709,7 @@ namespace UmaTest.App.Presentation.View | ||
704 | 709 | //dataGridView2.Columns["コース"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; |
705 | 710 | //dataGridView2.Columns["馬体重"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; |
706 | 711 | |
712 | + dataGridView2.Columns["形状"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
707 | 713 | dataGridView2.Columns["G"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; |
708 | 714 | dataGridView2.Columns["頭数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; |
709 | 715 | dataGridView2.Columns["馬場"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; |
@@ -925,8 +931,9 @@ namespace UmaTest.App.Presentation.View | ||
925 | 931 | DataGridViewCell cellGrade = row.Cells["G"]; |
926 | 932 | DataGridViewCell cellBasyo = row.Cells["場所"]; |
927 | 933 | DataGridViewCell cellCourse = row.Cells["コース"]; |
934 | + DataGridViewCell cellShape = row.Cells["形状"]; | |
928 | 935 | |
929 | - ColorizeGradeBasyoCourse(row, cellGrade, cellBasyo, cellCourse); | |
936 | + ColorizeGradeBasyoCourse(row, cellGrade, cellBasyo, cellCourse, cellShape); | |
930 | 937 | |
931 | 938 | DataGridViewCell cellNinki = row.Cells["人気"]; |
932 | 939 | DataGridViewCell cellJyuni = row.Cells["着順"]; |
@@ -948,7 +955,8 @@ namespace UmaTest.App.Presentation.View | ||
948 | 955 | } |
949 | 956 | } |
950 | 957 | |
951 | - private void ColorizeGradeBasyoCourse(DataGridViewRow row, DataGridViewCell cellGrade, DataGridViewCell cellBasyo, DataGridViewCell cellCourse) | |
958 | + private void ColorizeGradeBasyoCourse(DataGridViewRow row, DataGridViewCell cellGrade, | |
959 | + DataGridViewCell cellBasyo, DataGridViewCell cellCourse, DataGridViewCell cellShape) | |
952 | 960 | { |
953 | 961 | NRace race = null; |
954 | 962 |
@@ -963,12 +971,20 @@ namespace UmaTest.App.Presentation.View | ||
963 | 971 | return; |
964 | 972 | } |
965 | 973 | |
966 | - ColorizeGradeBasyoCourse(race, cellGrade, cellBasyo, cellCourse); | |
974 | + ColorizeGradeBasyoCourse(race, cellGrade, cellBasyo, cellCourse, cellShape); | |
967 | 975 | } |
968 | 976 | |
969 | - private void ColorizeGradeBasyoCourse(NRace race, DataGridViewCell cellGrade, DataGridViewCell cellBasyo, DataGridViewCell cellCourse) | |
977 | + private void ColorizeGradeBasyoCourse(NRace race, DataGridViewCell cellGrade, | |
978 | + DataGridViewCell cellBasyo, DataGridViewCell cellCourse) | |
970 | 979 | { |
971 | - if ( (race == null) || (cellGrade?.Value == null) || (cellBasyo?.Value == null) || (cellCourse?.Value == null) ) | |
980 | + ColorizeGradeBasyoCourse(race, cellGrade, cellBasyo, cellCourse, null); | |
981 | + } | |
982 | + | |
983 | + private void ColorizeGradeBasyoCourse(NRace race, DataGridViewCell cellGrade, | |
984 | + DataGridViewCell cellBasyo, DataGridViewCell cellCourse, DataGridViewCell cellShape) | |
985 | + { | |
986 | + if ( (race == null) || (cellGrade?.Value == null) | |
987 | + || (cellBasyo?.Value == null) || (cellCourse?.Value == null)) | |
972 | 988 | { |
973 | 989 | return; |
974 | 990 | } |
@@ -996,18 +1012,15 @@ namespace UmaTest.App.Presentation.View | ||
996 | 1012 | bool isNearCourse = isRowEqualTurfDirt && isRowNearKyori; |
997 | 1013 | bool isEqualCourse = isNearCourse && isRowEqualKyori && isRowEqualTrackCd; |
998 | 1014 | |
1015 | + bool isNearShape = isRowEqualTurfDirt && isRowNearKyori && isRowEqualTrackCd; | |
1016 | + bool isEqualShape = isNearShape && isRowEqualKyori; | |
1017 | + | |
999 | 1018 | bool isNearBasyoCourse = isNearCourse && isRowEqualJyoCd; |
1000 | 1019 | bool isEqualBasyoCourse = isNearBasyoCourse && isEqualCourse; |
1001 | 1020 | |
1002 | 1021 | bool isNearGrade = isNearCourse && isRowEqualGrade; |
1003 | 1022 | bool isEqualGrade = isNearGrade && isEqualBasyoCourse; |
1004 | 1023 | |
1005 | - (Color, Color) colorGrade = isNearGrade | |
1006 | - ? isEqualGrade | |
1007 | - ? AppConst.COLOR_FIRST | |
1008 | - : AppConst.COLOR_SECOND | |
1009 | - : AppConst.COLOR_NONE; | |
1010 | - | |
1011 | 1024 | (Color, Color) colorBasyo = isNearBasyoCourse |
1012 | 1025 | ? isEqualBasyoCourse |
1013 | 1026 | ? AppConst.COLOR_FIRST |
@@ -1020,10 +1033,17 @@ namespace UmaTest.App.Presentation.View | ||
1020 | 1033 | : AppConst.COLOR_SECOND |
1021 | 1034 | : AppConst.COLOR_NONE; |
1022 | 1035 | |
1023 | - if (colorGrade != AppConst.COLOR_NONE) | |
1024 | - { | |
1025 | - ChangeCellBackColor(cellGrade, colorGrade); | |
1026 | - } | |
1036 | + (Color, Color) colorShape = isNearShape | |
1037 | + ? isEqualShape | |
1038 | + ? AppConst.COLOR_FIRST | |
1039 | + : AppConst.COLOR_SECOND | |
1040 | + : AppConst.COLOR_NONE; | |
1041 | + | |
1042 | + (Color, Color) colorGrade = isNearGrade | |
1043 | + ? isEqualGrade | |
1044 | + ? AppConst.COLOR_FIRST | |
1045 | + : AppConst.COLOR_SECOND | |
1046 | + : AppConst.COLOR_NONE; | |
1027 | 1047 | |
1028 | 1048 | if (colorBasyo != AppConst.COLOR_NONE) |
1029 | 1049 | { |
@@ -1034,6 +1054,16 @@ namespace UmaTest.App.Presentation.View | ||
1034 | 1054 | { |
1035 | 1055 | ChangeCellBackColor(cellCourse, colorCourse); |
1036 | 1056 | } |
1057 | + | |
1058 | + if ( (cellShape != null) && (colorShape != AppConst.COLOR_NONE) ) | |
1059 | + { | |
1060 | + ChangeCellBackColor(cellShape, colorShape); | |
1061 | + } | |
1062 | + | |
1063 | + if (colorGrade != AppConst.COLOR_NONE) | |
1064 | + { | |
1065 | + ChangeCellBackColor(cellGrade, colorGrade); | |
1066 | + } | |
1037 | 1067 | } |
1038 | 1068 | |
1039 | 1069 | private static void ColorizeKankaku(DataGridViewCell cellKankaku) |
@@ -26,7 +26,7 @@ namespace UmaTest.Infra.Helper | ||
26 | 26 | public static readonly string KYAKUSITU_KUBUN = "9201"; |
27 | 27 | public static readonly string RACE_DATA_KUBUN = "9202"; |
28 | 28 | |
29 | - public const string TRACK_NAME_TURF_AND_DIRT = "芝ダ"; | |
29 | + public const string TRACK_NAME_TURF_TO_DIRT = "芝ダ"; | |
30 | 30 | public const string TRACK_NAME_TURF = "芝"; |
31 | 31 | public const string TRACK_NAME_DIRT = "ダ"; |
32 | 32 | public const string TRACK_NAME_SAND = "砂"; |
@@ -40,6 +40,7 @@ namespace UmaTest.Infra.Helper | ||
40 | 40 | public static readonly string RACE_CLASS_THREE_WINS = "3勝"; |
41 | 41 | |
42 | 42 | private const string NODATA = "-"; |
43 | + private const string NODETAIL = "―"; | |
43 | 44 | private const string NA = "NA"; |
44 | 45 | private const string UNKNOWN = "?"; |
45 | 46 | private const string ERROR_VALUE = "#ERROR"; |
@@ -66,15 +67,15 @@ namespace UmaTest.Infra.Helper | ||
66 | 67 | |
67 | 68 | public string GetRaceName(NRace race, string errorValue) |
68 | 69 | { |
69 | - return race != null ? GetRaceName(race.Hondai, race.Gradecd, race.Jyokencd5, errorValue) : string.Empty; | |
70 | + return race != null ? GetRaceName(race.Hondai, race.Gradecd, race.Jyokencd5, race.Kigocd, errorValue) : string.Empty; | |
70 | 71 | } |
71 | 72 | |
72 | 73 | public string GetRaceName(NTokuRace race, string errorValue) |
73 | 74 | { |
74 | - return race != null ? GetRaceName(race.Hondai, race.Gradecd, race.Jyokencd5, errorValue) : string.Empty; | |
75 | + return race != null ? GetRaceName(race.Hondai, race.Gradecd, race.Jyokencd5, race.Kigocd, errorValue) : string.Empty; | |
75 | 76 | } |
76 | 77 | |
77 | - private string GetRaceName(string hondai, string gradeCd, string jyokenCd, string errorValue) | |
78 | + private string GetRaceName(string hondai, string gradeCd, string jyokenCd, string kigoCd, string errorValue) | |
78 | 79 | { |
79 | 80 | if (!String.IsNullOrEmpty(hondai)) |
80 | 81 | { |
@@ -92,30 +93,49 @@ namespace UmaTest.Infra.Helper | ||
92 | 93 | |
93 | 94 | //Logger.Debug($"条件CD:{jyokenCd}"); |
94 | 95 | |
96 | + string winClass = string.Empty; | |
97 | + | |
95 | 98 | if (jyokenCd.CompareTo("100") <= 0) |
96 | 99 | { |
97 | 100 | if (int.TryParse(jyokenCd, out int shokin)) |
98 | 101 | { |
99 | 102 | if (shokin <= 5) |
100 | 103 | { |
101 | - return "1勝クラス"; | |
104 | + winClass = "1勝クラス"; | |
102 | 105 | } |
103 | 106 | else if (shokin <= 10) |
104 | 107 | { |
105 | - return "2勝クラス"; | |
108 | + winClass = "2勝クラス"; | |
106 | 109 | } |
107 | 110 | else if (shokin <= 16) |
108 | 111 | { |
109 | - return "3勝クラス"; | |
112 | + winClass = "3勝クラス"; | |
110 | 113 | } |
111 | 114 | else if (shokin <= 100) |
112 | 115 | { |
113 | - return "オープン戦"; | |
116 | + winClass = "オープン戦"; | |
114 | 117 | } |
115 | 118 | } |
116 | 119 | } |
117 | 120 | |
118 | - return GetName(CodeHelper.JYOKEN_CODE, jyokenCd, errorValue); | |
121 | + if (string.IsNullOrEmpty(winClass)) | |
122 | + { | |
123 | + winClass = GetName(CodeHelper.JYOKEN_CODE, jyokenCd, errorValue); | |
124 | + } | |
125 | + | |
126 | + string himba = GetHimbaName(kigoCd); | |
127 | + | |
128 | + if (!string.IsNullOrEmpty(himba)) | |
129 | + { | |
130 | + return $"{winClass} ({himba})"; | |
131 | + } | |
132 | + | |
133 | + return winClass; | |
134 | + } | |
135 | + | |
136 | + public string GetHimbaName(string kigoCd) | |
137 | + { | |
138 | + return (!string.IsNullOrEmpty(kigoCd) && (kigoCd.Length == 3) && (kigoCd[1] == '2')) ? "牝" : string.Empty; | |
119 | 139 | } |
120 | 140 | |
121 | 141 | public string GetGradeName(NRace race, string errorValue) |
@@ -187,13 +207,18 @@ namespace UmaTest.Infra.Helper | ||
187 | 207 | |
188 | 208 | string trackEngName = GetName(TRACK_CODE, trackCd, 2, errorValue); |
189 | 209 | |
210 | + if (trackEngName == errorValue) | |
211 | + { | |
212 | + return trackEngName; | |
213 | + } | |
214 | + | |
190 | 215 | if (trackCd.CompareTo("50") < 0) |
191 | 216 | { |
192 | 217 | return ExtractTurfDartName(trackEngName); |
193 | 218 | } |
194 | 219 | else |
195 | 220 | { |
196 | - string turfDartKbn = (trackCd != "52") ? ExtractTurfDartName(trackEngName) : TRACK_NAME_TURF_AND_DIRT; | |
221 | + string turfDartKbn = (trackCd != "52") ? ExtractTurfDartName(trackEngName) : TRACK_NAME_TURF_TO_DIRT; | |
197 | 222 | return TRACK_NAME_HURDLE + turfDartKbn; |
198 | 223 | } |
199 | 224 | } |
@@ -225,6 +250,57 @@ namespace UmaTest.Infra.Helper | ||
225 | 250 | return turfDartKbn; |
226 | 251 | } |
227 | 252 | |
253 | + public string GetTrackShapeName(string trackCd, string errorValue) | |
254 | + { | |
255 | + if (string.IsNullOrEmpty(trackCd)) | |
256 | + { | |
257 | + return string.Empty; | |
258 | + } | |
259 | + | |
260 | + string trackName = GetName(TRACK_CODE, trackCd, 1, errorValue); | |
261 | + | |
262 | + if (trackName == errorValue) | |
263 | + { | |
264 | + return trackName; | |
265 | + } | |
266 | + | |
267 | + if (trackCd.CompareTo("50") < 0) | |
268 | + { | |
269 | + return ExtractFlagTrackShapeName(trackName, errorValue); | |
270 | + } | |
271 | + else | |
272 | + { | |
273 | + return ExtractJumpTrackShapeName(trackName, errorValue); | |
274 | + } | |
275 | + } | |
276 | + | |
277 | + private string ExtractFlagTrackShapeName(string trackName, string errorValue) | |
278 | + { | |
279 | + string[] raceTypeAndTrackShape = trackName.Split('・'); | |
280 | + | |
281 | + if (raceTypeAndTrackShape.Length != 2) | |
282 | + { | |
283 | + return errorValue; | |
284 | + } | |
285 | + | |
286 | + return raceTypeAndTrackShape[1]; | |
287 | + } | |
288 | + | |
289 | + private string ExtractJumpTrackShapeName(string trackName, string errorValue) | |
290 | + { | |
291 | + if (!trackName.StartsWith("芝・")) | |
292 | + { | |
293 | + if (trackName == "芝") | |
294 | + { | |
295 | + return NODETAIL; | |
296 | + } | |
297 | + | |
298 | + return trackName; | |
299 | + } | |
300 | + | |
301 | + return trackName.Substring(2); | |
302 | + } | |
303 | + | |
228 | 304 | public string GetName(string code, string value, string errorValue = ERROR_VALUE) |
229 | 305 | { |
230 | 306 | return GetName(code, value, 0, errorValue); |
@@ -330,6 +330,95 @@ namespace UmaTest.Infra.Helper | ||
330 | 330 | return ((decimal)(time - haronTimeL3)) * (600 / divider) / (kyori - 600); |
331 | 331 | } |
332 | 332 | |
333 | + public static string FormatAvgHaronTime3(string time, string kyori) | |
334 | + { | |
335 | + if (string.IsNullOrEmpty(time) || string.IsNullOrEmpty(kyori)) | |
336 | + { | |
337 | + return string.Empty; | |
338 | + } | |
339 | + | |
340 | + if (time == INIT_DATA_0000) | |
341 | + { | |
342 | + return NODATA; | |
343 | + } | |
344 | + | |
345 | + try | |
346 | + { | |
347 | + // unit: 100[msec.] | |
348 | + int nTime = int.Parse(time.Substring(0, 1)) * 600 + int.Parse(time.Substring(1, 3)); | |
349 | + | |
350 | + int nKyori = int.Parse(kyori); | |
351 | + | |
352 | + return FormatAvgHaronTime3(nTime, nKyori); | |
353 | + } | |
354 | + catch (Exception) | |
355 | + { | |
356 | + return NA; | |
357 | + } | |
358 | + } | |
359 | + | |
360 | + public static string FormatAvgHaronTime3(int time, int kyori) | |
361 | + { | |
362 | + if (time == -1) | |
363 | + { | |
364 | + return NODATA; | |
365 | + } | |
366 | + | |
367 | + // unit: 1[sec.] | |
368 | + decimal avgHaronTime3 = CalcAvgHaronTime3(time, kyori, 10); | |
369 | + | |
370 | + return Math.Round(avgHaronTime3, 2, MidpointRounding.AwayFromZero).ToString("0.00"); | |
371 | + } | |
372 | + | |
373 | + public static string FormatAvgHaronTime3Dev(string time, string kyori, decimal? avgAvgHaronTime3F, decimal? stdDevtAvgHaronTime3) | |
374 | + { | |
375 | + if (string.IsNullOrEmpty(time) || string.IsNullOrEmpty(kyori) | |
376 | + || !avgAvgHaronTime3F.HasValue || !stdDevtAvgHaronTime3.HasValue) | |
377 | + { | |
378 | + return string.Empty; | |
379 | + } | |
380 | + | |
381 | + if (time == INIT_DATA_0000) | |
382 | + { | |
383 | + return NODATA; | |
384 | + } | |
385 | + | |
386 | + try | |
387 | + { | |
388 | + // unit: 100[msec.] | |
389 | + int nTime = int.Parse(time.Substring(0, 1)) * 600 + int.Parse(time.Substring(1, 3)); | |
390 | + | |
391 | + int nKyori = int.Parse(kyori); | |
392 | + | |
393 | + return FormatAvgHaronTime3Dev(nTime, nKyori, avgAvgHaronTime3F, stdDevtAvgHaronTime3); | |
394 | + } | |
395 | + catch (Exception) | |
396 | + { | |
397 | + return NA; | |
398 | + } | |
399 | + } | |
400 | + | |
401 | + public static string FormatAvgHaronTime3Dev(int time, int kyori, decimal? avgAvgHaronTime3F, decimal? stdDevtAvgHaronTime3) | |
402 | + { | |
403 | + if (time == -1) | |
404 | + { | |
405 | + return NODATA; | |
406 | + } | |
407 | + | |
408 | + // unit: 100[msec.] | |
409 | + decimal avgHaronTime3 = CalcAvgHaronTime3(time, kyori, 1); | |
410 | + | |
411 | + decimal dev = CalcScoreByStdDevReverse(avgHaronTime3, avgAvgHaronTime3F.Value, stdDevtAvgHaronTime3.Value, 100, 20); | |
412 | + | |
413 | + return Math.Round(dev, 1, MidpointRounding.AwayFromZero).ToString("#0.0"); | |
414 | + } | |
415 | + | |
416 | + private static decimal CalcAvgHaronTime3(int time, int kyori, int divider) | |
417 | + { | |
418 | + // unit: 1[sec.] / divider | |
419 | + return ((decimal)time) * (600 / divider) / kyori; | |
420 | + } | |
421 | + | |
333 | 422 | public static string FormatPCI(string haronTimeL3, decimal? avgAvgHaronTimeMinus3F, decimal? stdDevtAvgHaronTimeMinus3) |
334 | 423 | { |
335 | 424 | if (string.IsNullOrEmpty(haronTimeL3)) |
@@ -496,19 +585,7 @@ namespace UmaTest.Infra.Helper | ||
496 | 585 | string sibaJyotai = CodeHelper.GetInstance().GetName(CodeHelper.BABA_JYOTAI_CODE, race.Sibababacd, string.Empty); |
497 | 586 | string dirtJyotai = CodeHelper.GetInstance().GetName(CodeHelper.BABA_JYOTAI_CODE, race.Dirtbabacd, string.Empty); |
498 | 587 | |
499 | - string turfDirtName = CodeHelper.GetInstance().GetTurfDurtName(race.Trackcd, string.Empty); | |
500 | - | |
501 | - switch(turfDirtName) | |
502 | - { | |
503 | - case CodeHelper.TRACK_NAME_TURF: | |
504 | - return sibaJyotai; | |
505 | - case CodeHelper.TRACK_NAME_DIRT: | |
506 | - return dirtJyotai; | |
507 | - case CodeHelper.TRACK_NAME_TURF_AND_DIRT: | |
508 | - return !string.IsNullOrEmpty(sibaJyotai) && !string.IsNullOrEmpty(dirtJyotai) ? sibaJyotai + "・" + dirtJyotai : string.Empty; | |
509 | - } | |
510 | - | |
511 | - return string.Empty; | |
588 | + return sibaJyotai + (!string.IsNullOrEmpty(sibaJyotai) && !string.IsNullOrEmpty(dirtJyotai) ? "/" : string.Empty) + dirtJyotai; | |
512 | 589 | } |
513 | 590 | |
514 | 591 | public static string FormatTosu(NTokuRace race) |
@@ -45,7 +45,7 @@ from | ||
45 | 45 | left join n_course c |
46 | 46 | using(jyocd, kyori, trackcd) |
47 | 47 | ) |
48 | -SELECT ur.*, r.*, k.*, c.*, ot.*, h1.*, h5.*, urdev.* | |
48 | +SELECT ur.*, r.*, k.*, c.*, ot.*, h1.*, h5.*, urstat.* | |
49 | 49 | FROM n_uma_race ur |
50 | 50 | INNER JOIN n_race r USING(year, jyocd, kaiji, nichiji, racenum) |
51 | 51 | LEFT JOIN n_uma u USING(kettonum) |
@@ -75,12 +75,12 @@ AND vur.gradecd = case r.gradecd | ||
75 | 75 | else r.gradecd |
76 | 76 | end |
77 | 77 | AND r.syubetucd = vur.syubetucd |
78 | -LEFT JOIN app_uma_race_stddev urdev | |
79 | - ON vur.jyocd = urdev.jyocd | |
80 | -AND vur.kyori = urdev.kyori | |
81 | -AND vur.trackcd = urdev.trackcd | |
82 | -AND vur.gradecd = urdev.gradecd | |
83 | -AND vur.syubetucd = urdev.syubetucd | |
84 | -AND vur.kaishudate = urdev.kaishudate | |
78 | +LEFT JOIN app_uma_race_stat urstat | |
79 | + ON vur.jyocd = urstat.jyocd | |
80 | +AND vur.kyori = urstat.kyori | |
81 | +AND vur.trackcd = urstat.trackcd | |
82 | +AND vur.gradecd = urstat.gradecd | |
83 | +AND vur.syubetucd = urstat.syubetucd | |
84 | +AND vur.kaishudate = urstat.kaishudate | |
85 | 85 | WHERE ur.kettonum in (@KettoNums) |
86 | 86 | ORDER BY ur.kettonum, ur.year desc, ur.monthday desc |
\ No newline at end of file |
@@ -1,4 +1,4 @@ | ||
1 | -create table app_uma_race_stddev as | |
1 | +create table app_uma_race_stat as | |
2 | 2 | with v_uma_race_base1 as ( |
3 | 3 | select |
4 | 4 | r.jyocd |
@@ -62,12 +62,15 @@ select | ||
62 | 62 | + to_number(substring(ur.time, 2, 2), '00') * 10 |
63 | 63 | + to_number(substring(ur.time, 4, 1), '0') |
64 | 64 | end as time |
65 | - , case ur.harontimel3 | |
66 | - when '000' then null | |
67 | - when '999' then null | |
68 | - when ' ' then null | |
69 | - else to_number(substring(ur.harontimel3, 1, 2), '00') * 10 | |
70 | - + to_number(substring(ur.harontimel3, 3, 1), '0') | |
65 | + , case | |
66 | + when ur.trackcd >= '50' then null | |
67 | + else case ur.harontimel3 | |
68 | + when '000' then null | |
69 | + when '999' then null | |
70 | + when ' ' then null | |
71 | + else to_number(substring(ur.harontimel3, 1, 2), '00') * 10 | |
72 | + + to_number(substring(ur.harontimel3, 3, 1), '0') | |
73 | + end | |
71 | 74 | end as harontimel3 |
72 | 75 | from |
73 | 76 | v_uma_race_base2 ur |
@@ -81,9 +84,12 @@ select | ||
81 | 84 | , ur.kaishudate |
82 | 85 | , ur.time |
83 | 86 | , ur.harontimel3 |
84 | - , case ur.harontimel3 | |
85 | - when null then null | |
86 | - else (ur.time - ur.harontimel3) * 600 / (ur.kyori - 600) | |
87 | + , case | |
88 | + when ur.trackcd >= '50' then ur.time * 600 / ur.kyori | |
89 | + else case ur.harontimel3 | |
90 | + when null then null | |
91 | + else (ur.time - ur.harontimel3) * 600 / (ur.kyori - 600) | |
92 | + end | |
87 | 93 | end as avgharontimeminus3 |
88 | 94 | from |
89 | 95 | v_uma_race_base3 ur |
@@ -125,7 +131,7 @@ order by | ||
125 | 131 | , ur.syubetucd |
126 | 132 | , ur.kaishudate |
127 | 133 | ; |
128 | -alter table app_uma_race_stddev add constraint pk_app_uma_race_stddev primary key (jyocd, kyori, trackcd, gradecd, syubetucd, kaishudate) | |
134 | +alter table app_uma_race_stat add constraint pk_app_uma_race_stat primary key (jyocd, kyori, trackcd, gradecd, syubetucd, kaishudate) | |
129 | 135 | ; |
130 | -drop table app_uma_race_stddev | |
136 | +drop table app_uma_race_stat | |
131 | 137 | ; |