|
|
@@ -58,11 +58,10 @@ public class TestingTabController implements Initializable {
|
|
|
|
|
|
@FXML TextField topCountTextField;
|
|
|
|
|
|
- @FXML TextField horseDriverSameOrderValue;
|
|
|
- @FXML TextField horseDriverDistanceSameOrderValue;
|
|
|
- @FXML TextField AllFourBasicSameOrderValue;
|
|
|
- @FXML TextField AllSameOrderValue;
|
|
|
-
|
|
|
+ @FXML Label horseDriverSameOrderValue;
|
|
|
+ @FXML Label horseDriverDistanceSameOrderValue;
|
|
|
+ @FXML Label AllFourBasicSameOrderValue;
|
|
|
+ @FXML Label AllSameOrderValue;
|
|
|
|
|
|
@FXML TextField combineHorseWeight;
|
|
|
@FXML TextField combineDriverWeight;
|
|
|
@@ -72,7 +71,7 @@ public class TestingTabController implements Initializable {
|
|
|
private CSVParser parser;
|
|
|
ArrayList<TestDatabaseRow> testData = Lists.newArrayList();
|
|
|
|
|
|
- ArrayList<TestDataRow> threeMonthsData = Lists.newArrayList();
|
|
|
+ ArrayList<TestDataRow> dbDumpTestData = Lists.newArrayList();
|
|
|
|
|
|
final HashMap<ArrayList<String>, List<SimpleEntry<Integer, Float>>> autostartWinPercentages = Maps.newHashMap();
|
|
|
final HashMap<ArrayList<String>, List<SimpleEntry<Integer, Float>>> voltstartWinPercentages = Maps.newHashMap();
|
|
|
@@ -147,14 +146,14 @@ public class TestingTabController implements Initializable {
|
|
|
private void ReadTestData() {
|
|
|
final Character delimiter = ',';
|
|
|
BufferedReader br;
|
|
|
- threeMonthsData = Lists.newArrayList();
|
|
|
+ dbDumpTestData = Lists.newArrayList();
|
|
|
try {
|
|
|
br = new BufferedReader(new FileReader(testDataSetFile));
|
|
|
parser = CSVFormat.DEFAULT.withDelimiter(delimiter).withHeader().parse(br);
|
|
|
|
|
|
for (final CSVRecord record : parser) {
|
|
|
final TestDataRow row = new TestDataRow(record.toMap());
|
|
|
- threeMonthsData.add(row);
|
|
|
+ dbDumpTestData.add(row);
|
|
|
}
|
|
|
} catch (final IOException e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -223,7 +222,7 @@ public class TestingTabController implements Initializable {
|
|
|
public void getPercentagesOrderedBy(int topCount) {
|
|
|
// sort by RaceDate, TrackId, RaceNumber
|
|
|
|
|
|
- Collections.sort(threeMonthsData, new TestDataRow.RaceDateSorter()
|
|
|
+ Collections.sort(dbDumpTestData, new TestDataRow.RaceDateSorter()
|
|
|
.thenComparing(new TestDataRow.TrackIdSorter())
|
|
|
.thenComparing(new TestDataRow.RaceNumberSorter()));
|
|
|
|
|
|
@@ -234,9 +233,15 @@ public class TestingTabController implements Initializable {
|
|
|
int correctCustom = 0;
|
|
|
int correctCombined = 0;
|
|
|
int racesCount = 0;
|
|
|
- for (int i = 0; i < threeMonthsData.size(); i++) {
|
|
|
- final TestDataRow firstRow = threeMonthsData.get(i);
|
|
|
- final List<TestDataRow> currentRaces = threeMonthsData.stream().filter(d -> firstRow.getRaceDate().equals(d.getRaceDate()) &&
|
|
|
+
|
|
|
+ int correctSameHorseDriver = 0;
|
|
|
+ int correctSameHorseDriverByDistance = 0;
|
|
|
+ int correctSameAllFour = 0;
|
|
|
+ int correctSameAll = 0;
|
|
|
+
|
|
|
+ for (int i = 0; i < dbDumpTestData.size(); i++) {
|
|
|
+ final TestDataRow firstRow = dbDumpTestData.get(i);
|
|
|
+ final List<TestDataRow> currentRaces = dbDumpTestData.stream().filter(d -> firstRow.getRaceDate().equals(d.getRaceDate()) &&
|
|
|
firstRow.getTrackId() == d.getTrackId() &&
|
|
|
firstRow.getRaceNumber() == d.getRaceNumber()).collect(Collectors.toList());
|
|
|
|
|
|
@@ -277,6 +282,8 @@ public class TestingTabController implements Initializable {
|
|
|
currentRaces.forEach(cr -> cr.setLaneWinDivisor(Float.valueOf(divisorValueCustom.getText())));
|
|
|
correctCustom = checkIfCorrect(topCount, correctCustom, currentRaces, new customSorter());
|
|
|
|
|
|
+
|
|
|
+
|
|
|
final float horseWeight = Float.valueOf(combineHorseWeight.getText());
|
|
|
final float driverWeight = Float.valueOf(combineDriverWeight.getText());
|
|
|
currentRaces.forEach(cr -> cr.setLaneWinDivisor(Float.valueOf(divisorValueCombined.getText())));
|
|
|
@@ -324,6 +331,7 @@ public class TestingTabController implements Initializable {
|
|
|
}
|
|
|
// updateTextColor(correctHorse, racesCount, horseAvgTimePercentText);
|
|
|
|
|
|
+
|
|
|
|
|
|
horseAvgTimePercentValue.setText(String.valueOf(correctHorse/(racesCount * 1f) * 100) + "%");
|
|
|
horseAvgTimeByDistancePercentValue.setText(String.valueOf(correctHorseByDistance/(racesCount * 1f) * 100) + "%");
|