فهرست منبع

Placement updates with date

Axel Nordh 4 سال پیش
والد
کامیت
bde2f60c8d

+ 37 - 36
ATG/src/controllers/NewTab/DriverController.java

@@ -6,6 +6,7 @@ import java.util.ResourceBundle;
 import javafx.fxml.FXML;
 import javafx.fxml.Initializable;
 import javafx.scene.control.Label;
+import objects.ResultsDTO;
 
 public class DriverController implements Initializable {
 
@@ -74,7 +75,7 @@ public class DriverController implements Initializable {
         this.avgTimeLabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeLabel(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeLabel(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeLabel.setText(firstValue.toString());
         this.avgTimeLabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeLabelCompare.setText(compareValue.toString());
@@ -84,10 +85,10 @@ public class DriverController implements Initializable {
 
         this.avgTimeLabelTotal.setDisable(false);
         this.avgTimeLabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeLabel.setStyle("-fx-text-fill: green;");
             this.avgTimeLabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeLabel.setStyle("-fx-text-fill: red;");
             this.avgTimeLabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -106,7 +107,7 @@ public class DriverController implements Initializable {
         this.avgTimeDistanceLimit5LabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistance5LabelWithCompare(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistance5LabelWithCompare(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLimit5Label.setText(firstValue.toString());
         this.avgTimeDistanceLimit5LabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLimit5LabelCompare.setText(compareValue.toString());
@@ -116,10 +117,10 @@ public class DriverController implements Initializable {
 
         this.avgTimeDistanceLimit5LabelTotal.setDisable(false);
         this.avgTimeDistanceLimit5LabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -137,7 +138,7 @@ public class DriverController implements Initializable {
         this.avgTimeDistanceLabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLabel(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistanceLabel(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLabel.setText(firstValue.toString());
         this.avgTimeDistanceLabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLabelCompare.setText(compareValue.toString());
@@ -147,10 +148,10 @@ public class DriverController implements Initializable {
 
         this.avgTimeDistanceLabelTotal.setDisable(false);
         this.avgTimeDistanceLabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLabel.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLabel.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -169,7 +170,7 @@ public class DriverController implements Initializable {
         this.avgTimeDistanceLimit10LabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLimit10Label(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistanceLimit10Label(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLimit10Label.setText(firstValue.toString());
         this.avgTimeDistanceLimit10LabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLimit10LabelCompare.setText(compareValue.toString());
@@ -179,10 +180,10 @@ public class DriverController implements Initializable {
 
         this.avgTimeDistanceLimit10LabelTotal.setDisable(false);
         this.avgTimeDistanceLimit10LabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -201,7 +202,7 @@ public class DriverController implements Initializable {
         this.avgTimeDistanceLimit15LabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLimit15Label(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistanceLimit15Label(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLimit15Label.setText(firstValue.toString());
         this.avgTimeDistanceLimit15LabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLimit15LabelCompare.setText(compareValue.toString());
@@ -211,10 +212,10 @@ public class DriverController implements Initializable {
 
         this.avgTimeDistanceLimit15LabelTotal.setDisable(false);
         this.avgTimeDistanceLimit15LabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -233,7 +234,7 @@ public class DriverController implements Initializable {
         this.avgPositionVS.setOpacity(0);
     }
 
-    public void setAvgPosition(Float firstValue, Float compareValue) {
+    public void setAvgPosition(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPosition.setText(firstValue.toString());
         this.avgPositionCompare.setText(compareValue.toString());
 
@@ -242,10 +243,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionVS.setDisable(false);
         this.avgPositionVS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPosition.setStyle("-fx-text-fill: green;");
             this.avgPositionCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPosition.setStyle("-fx-text-fill: red;");
             this.avgPositionCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -264,7 +265,7 @@ public class DriverController implements Initializable {
         this.avgPositionLast5VS.setOpacity(0);
     }
 
-    public void setAvgPositionLast5(Float firstValue, Float compareValue) {
+    public void setAvgPositionLast5(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionLast5.setText(firstValue.toString());
         this.avgPositionLast5Compare.setText(compareValue.toString());
 
@@ -273,10 +274,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionLast5VS.setDisable(false);
         this.avgPositionLast5VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionLast5.setStyle("-fx-text-fill: green;");
             this.avgPositionLast5Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionLast5.setStyle("-fx-text-fill: red;");
             this.avgPositionLast5Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -295,7 +296,7 @@ public class DriverController implements Initializable {
         this.avgPositionLast10VS.setOpacity(0);
     }
 
-    public void setAvgPositionLast10(Float firstValue, Float compareValue) {
+    public void setAvgPositionLast10(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionLast10.setText(firstValue.toString());
         this.avgPositionLast10Compare.setText(compareValue.toString());
 
@@ -304,10 +305,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionLast10VS.setDisable(false);
         this.avgPositionLast10VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionLast10.setStyle("-fx-text-fill: green;");
             this.avgPositionLast10Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionLast10.setStyle("-fx-text-fill: red;");
             this.avgPositionLast10Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -326,7 +327,7 @@ public class DriverController implements Initializable {
         this.avgPositionLast15VS.setOpacity(0);
     }
 
-    public void setAvgPositionLast15(Float firstValue, Float compareValue) {
+    public void setAvgPositionLast15(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionLast15.setText(firstValue.toString());
         this.avgPositionLast15Compare.setText(compareValue.toString());
 
@@ -335,10 +336,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionLast15VS.setDisable(false);
         this.avgPositionLast15VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionLast15.setStyle("-fx-text-fill: green;");
             this.avgPositionLast15Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionLast15.setStyle("-fx-text-fill: red;");
             this.avgPositionLast15Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -357,7 +358,7 @@ public class DriverController implements Initializable {
         this.avgPositionDistanceLast5VS.setOpacity(0);
     }
 
-    public void setAvgPositionDistanceLast5(Float firstValue, Float compareValue) {
+    public void setAvgPositionDistanceLast5(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionDistanceLast5.setText(firstValue.toString());
         this.avgPositionDistanceLast5Compare.setText(compareValue.toString());
 
@@ -366,10 +367,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionDistanceLast5VS.setDisable(false);
         this.avgPositionDistanceLast5VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionDistanceLast5.setStyle("-fx-text-fill: green;");
             this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionDistanceLast5.setStyle("-fx-text-fill: red;");
             this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -388,7 +389,7 @@ public class DriverController implements Initializable {
         this.avgPositionDistanceLast10VS.setOpacity(0);
     }
 
-    public void setAvgPositionDistanceLast10(Float firstValue, Float compareValue) {
+    public void setAvgPositionDistanceLast10(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionDistanceLast10.setText(firstValue.toString());
         this.avgPositionDistanceLast10Compare.setText(compareValue.toString());
 
@@ -397,10 +398,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionDistanceLast10VS.setDisable(false);
         this.avgPositionDistanceLast10VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionDistanceLast10.setStyle("-fx-text-fill: green;");
             this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionDistanceLast10.setStyle("-fx-text-fill: red;");
             this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -419,7 +420,7 @@ public class DriverController implements Initializable {
         this.avgPositionDistanceLast15VS.setOpacity(0);
     }
 
-    public void setAvgPositionDistanceLast15(Float firstValue, Float compareValue) {
+    public void setAvgPositionDistanceLast15(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionDistanceLast15.setText(firstValue.toString());
         this.avgPositionDistanceLast15Compare.setText(compareValue.toString());
 
@@ -428,10 +429,10 @@ public class DriverController implements Initializable {
 
         this.avgPositionDistanceLast15VS.setDisable(false);
         this.avgPositionDistanceLast15VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionDistanceLast15.setStyle("-fx-text-fill: green;");
             this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionDistanceLast15.setStyle("-fx-text-fill: red;");
             this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: green;");
         } else {

+ 399 - 4
ATG/src/controllers/NewTab/EkipageController.java

@@ -6,16 +6,52 @@ import java.util.ResourceBundle;
 import javafx.fxml.FXML;
 import javafx.fxml.Initializable;
 import javafx.scene.control.Label;
+import objects.ResultsDTO;
 
 public class EkipageController implements Initializable {
 
-
-    private static EkipageController controller;
+    @FXML Label ekipageNameLabel;
     @FXML Label avgTimeLabel;
+    @FXML Label avgTimeLabelTotal;
+    @FXML Label avgTimeLabelCompare;
     @FXML Label avgTimeDistanceLabel;
+    @FXML Label avgTimeDistanceLabelTotal;
+    @FXML Label avgTimeDistanceLabelCompare;
     @FXML Label avgTimeDistanceLimit5Label;
+    @FXML Label avgTimeDistanceLimit5LabelTotal;
+    @FXML Label avgTimeDistanceLimit5LabelCompare;
     @FXML Label avgTimeDistanceLimit10Label;
+    @FXML Label avgTimeDistanceLimit10LabelTotal;
+    @FXML Label avgTimeDistanceLimit10LabelCompare;
     @FXML Label avgTimeDistanceLimit15Label;
+    @FXML Label avgTimeDistanceLimit15LabelTotal;
+    @FXML Label avgTimeDistanceLimit15LabelCompare;
+
+    @FXML Label avgPosition;
+    @FXML Label avgPositionCompare;
+    @FXML Label avgPositionLast5;
+    @FXML Label avgPositionLast10;
+    @FXML Label avgPositionLast15;
+    @FXML Label avgPositionLast5Compare;
+    @FXML Label avgPositionLast10Compare;
+    @FXML Label avgPositionLast15Compare;
+    @FXML Label avgPositionDistanceLast5;
+    @FXML Label avgPositionDistanceLast10;
+    @FXML Label avgPositionDistanceLast15;
+    @FXML Label avgPositionDistanceLast5Compare;
+    @FXML Label avgPositionDistanceLast10Compare;
+    @FXML Label avgPositionDistanceLast15Compare;
+
+    @FXML Label avgPositionVS;
+    @FXML Label avgPositionDistanceLast5VS;
+    @FXML Label avgPositionDistanceLast10VS;
+    @FXML Label avgPositionDistanceLast15VS;
+    @FXML Label avgPositionLast5VS;
+    @FXML Label avgPositionLast10VS;
+    @FXML Label avgPositionLast15VS;
+
+    private static EkipageController controller;
+
     @Override
     public void initialize(URL arg0, ResourceBundle arg1) {
         controller = this;
@@ -25,24 +61,383 @@ public class EkipageController implements Initializable {
         return controller;
     }
 
+    public void setEkipageName(String name) {
+        this.ekipageNameLabel.setText(name);
+    }
+
     public void setAvgTimeLabel(String value) {
         this.avgTimeLabel.setText(value);
+
+        this.avgTimeLabelCompare.setDisable(true);
+        this.avgTimeLabelCompare.setOpacity(0);
+
+        this.avgTimeLabelTotal.setDisable(true);
+        this.avgTimeLabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLabel(String value) {
-        this.avgTimeDistanceLabel.setText(value);
+    public void setAvgTimeLabel(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
+        this.avgTimeLabel.setText(firstValue.toString());
+        this.avgTimeLabelTotal.setText(" (" + globalAvg.toString() + ") ");
+        this.avgTimeLabelCompare.setText(compareValue.toString());
+
+        this.avgTimeLabelCompare.setDisable(false);
+        this.avgTimeLabelCompare.setOpacity(1);
+
+        this.avgTimeLabelTotal.setDisable(false);
+        this.avgTimeLabelTotal.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgTimeLabel.setStyle("-fx-text-fill: green;");
+            this.avgTimeLabelCompare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgTimeLabel.setStyle("-fx-text-fill: red;");
+            this.avgTimeLabelCompare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgTimeLabel.setStyle("-fx-text-fill: black;");
+            this.avgTimeLabelCompare.setStyle("-fx-text-fill: black;");
+        }
     }
 
     public void setAvgTimeDistanceLimit5Label(String value) {
         this.avgTimeDistanceLimit5Label.setText(value);
+
+        this.avgTimeDistanceLimit5LabelCompare.setDisable(true);
+        this.avgTimeDistanceLimit5LabelCompare.setOpacity(0);
+
+        this.avgTimeDistanceLimit5LabelTotal.setDisable(true);
+        this.avgTimeDistanceLimit5LabelTotal.setOpacity(0);
+    }
+
+    public void setAvgTimeDistance5LabelWithCompare(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
+        this.avgTimeDistanceLimit5Label.setText(firstValue.toString());
+        this.avgTimeDistanceLimit5LabelTotal.setText(" (" + globalAvg.toString() + ") ");
+        this.avgTimeDistanceLimit5LabelCompare.setText(compareValue.toString());
+
+        this.avgTimeDistanceLimit5LabelCompare.setDisable(false);
+        this.avgTimeDistanceLimit5LabelCompare.setOpacity(1);
+
+        this.avgTimeDistanceLimit5LabelTotal.setDisable(false);
+        this.avgTimeDistanceLimit5LabelTotal.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: green;");
+            this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: red;");
+            this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: black;");
+            this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgTimeDistanceLabel(String value) {
+        this.avgTimeDistanceLabel.setText(value);
+        this.avgTimeDistanceLabelCompare.setDisable(true);
+        this.avgTimeDistanceLabelCompare.setOpacity(0);
+
+        this.avgTimeDistanceLabelTotal.setDisable(true);
+        this.avgTimeDistanceLabelTotal.setOpacity(0);
+    }
+
+    public void setAvgTimeDistanceLabel(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
+        this.avgTimeDistanceLabel.setText(firstValue.toString());
+        this.avgTimeDistanceLabelTotal.setText(" (" + globalAvg.toString() + ") ");
+        this.avgTimeDistanceLabelCompare.setText(compareValue.toString());
+
+        this.avgTimeDistanceLabelCompare.setDisable(false);
+        this.avgTimeDistanceLabelCompare.setOpacity(1);
+
+        this.avgTimeDistanceLabelTotal.setDisable(false);
+        this.avgTimeDistanceLabelTotal.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgTimeDistanceLabel.setStyle("-fx-text-fill: green;");
+            this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgTimeDistanceLabel.setStyle("-fx-text-fill: red;");
+            this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgTimeDistanceLabel.setStyle("-fx-text-fill: black;");
+            this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: black;");
+        }
     }
 
     public void setAvgTimeDistanceLimit10Label(String value) {
         this.avgTimeDistanceLimit10Label.setText(value);
+
+        this.avgTimeDistanceLimit10LabelCompare.setDisable(true);
+        this.avgTimeDistanceLimit10LabelCompare.setOpacity(0);
+
+        this.avgTimeDistanceLimit10LabelTotal.setDisable(true);
+        this.avgTimeDistanceLimit10LabelTotal.setOpacity(0);
+    }
+
+    public void setAvgTimeDistanceLimit10Label(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
+        this.avgTimeDistanceLimit10Label.setText(firstValue.toString());
+        this.avgTimeDistanceLimit10LabelTotal.setText(" (" + globalAvg.toString() + ") ");
+        this.avgTimeDistanceLimit10LabelCompare.setText(compareValue.toString());
+
+        this.avgTimeDistanceLimit10LabelCompare.setDisable(false);
+        this.avgTimeDistanceLimit10LabelCompare.setOpacity(1);
+
+        this.avgTimeDistanceLimit10LabelTotal.setDisable(false);
+        this.avgTimeDistanceLimit10LabelTotal.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: green;");
+            this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: red;");
+            this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: black;");
+            this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: black;");
+        }
     }
 
     public void setAvgTimeDistanceLimit15Label(String value) {
         this.avgTimeDistanceLimit15Label.setText(value);
+
+        this.avgTimeDistanceLimit15LabelCompare.setDisable(true);
+        this.avgTimeDistanceLimit15LabelCompare.setOpacity(0);
+
+        this.avgTimeDistanceLimit15LabelTotal.setDisable(true);
+        this.avgTimeDistanceLimit15LabelTotal.setOpacity(0);
+    }
+
+    public void setAvgTimeDistanceLimit15Label(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
+        this.avgTimeDistanceLimit15Label.setText(firstValue.toString());
+        this.avgTimeDistanceLimit15LabelTotal.setText(" (" + globalAvg.toString() + ") ");
+        this.avgTimeDistanceLimit15LabelCompare.setText(compareValue.toString());
+
+        this.avgTimeDistanceLimit15LabelCompare.setDisable(false);
+        this.avgTimeDistanceLimit15LabelCompare.setOpacity(1);
+
+        this.avgTimeDistanceLimit15LabelTotal.setDisable(false);
+        this.avgTimeDistanceLimit15LabelTotal.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: green;");
+            this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: red;");
+            this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: black;");
+            this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPosition(String value) {
+        this.avgPosition.setText(value);
+
+        this.avgPositionCompare.setDisable(true);
+        this.avgPositionCompare.setOpacity(0);
+
+        this.avgPositionVS.setDisable(true);
+        this.avgPositionVS.setOpacity(0);
     }
 
+    public void setAvgPosition(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPosition.setText(firstValue.toString());
+        this.avgPositionCompare.setText(compareValue.toString());
+
+        this.avgPositionCompare.setDisable(false);
+        this.avgPositionCompare.setOpacity(1);
+
+        this.avgPositionVS.setDisable(false);
+        this.avgPositionVS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPosition.setStyle("-fx-text-fill: green;");
+            this.avgPositionCompare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPosition.setStyle("-fx-text-fill: red;");
+            this.avgPositionCompare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPosition.setStyle("-fx-text-fill: black;");
+            this.avgPositionCompare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPositionLast5(String value) {
+        this.avgPositionLast5.setText(value);
+
+        this.avgPositionLast5Compare.setDisable(true);
+        this.avgPositionLast5Compare.setOpacity(0);
+
+        this.avgPositionLast5VS.setDisable(true);
+        this.avgPositionLast5VS.setOpacity(0);
+    }
+
+    public void setAvgPositionLast5(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPositionLast5.setText(firstValue.toString());
+        this.avgPositionLast5Compare.setText(compareValue.toString());
+
+        this.avgPositionLast5Compare.setDisable(false);
+        this.avgPositionLast5Compare.setOpacity(1);
+
+        this.avgPositionLast5VS.setDisable(false);
+        this.avgPositionLast5VS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPositionLast5.setStyle("-fx-text-fill: green;");
+            this.avgPositionLast5Compare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPositionLast5.setStyle("-fx-text-fill: red;");
+            this.avgPositionLast5Compare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPositionLast5.setStyle("-fx-text-fill: black;");
+            this.avgPositionLast5Compare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPositionLast10(String value) {
+        this.avgPositionLast10.setText(value);
+
+        this.avgPositionLast10Compare.setDisable(true);
+        this.avgPositionLast10Compare.setOpacity(0);
+
+        this.avgPositionLast10VS.setDisable(true);
+        this.avgPositionLast10VS.setOpacity(0);
+    }
+
+    public void setAvgPositionLast10(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPositionLast10.setText(firstValue.toString());
+        this.avgPositionLast10Compare.setText(compareValue.toString());
+
+        this.avgPositionLast10Compare.setDisable(false);
+        this.avgPositionLast10Compare.setOpacity(1);
+
+        this.avgPositionLast10VS.setDisable(false);
+        this.avgPositionLast10VS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPositionLast10.setStyle("-fx-text-fill: green;");
+            this.avgPositionLast10Compare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPositionLast10.setStyle("-fx-text-fill: red;");
+            this.avgPositionLast10Compare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPositionLast10.setStyle("-fx-text-fill: black;");
+            this.avgPositionLast10Compare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPositionLast15(String value) {
+        this.avgPositionLast15.setText(value);
+
+        this.avgPositionLast15Compare.setDisable(true);
+        this.avgPositionLast15Compare.setOpacity(0);
+
+        this.avgPositionLast15VS.setDisable(true);
+        this.avgPositionLast15VS.setOpacity(0);
+    }
+
+    public void setAvgPositionLast15(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPositionLast15.setText(firstValue.toString());
+        this.avgPositionLast15Compare.setText(compareValue.toString());
+
+        this.avgPositionLast15Compare.setDisable(false);
+        this.avgPositionLast15Compare.setOpacity(1);
+
+        this.avgPositionLast15VS.setDisable(false);
+        this.avgPositionLast15VS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPositionLast15.setStyle("-fx-text-fill: green;");
+            this.avgPositionLast15Compare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPositionLast15.setStyle("-fx-text-fill: red;");
+            this.avgPositionLast15Compare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPositionLast15.setStyle("-fx-text-fill: black;");
+            this.avgPositionLast15Compare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPositionDistanceLast5(String value) {
+        this.avgPositionDistanceLast5.setText(value);
+
+        this.avgPositionDistanceLast5Compare.setDisable(true);
+        this.avgPositionDistanceLast5Compare.setOpacity(0);
+
+        this.avgPositionDistanceLast5VS.setDisable(true);
+        this.avgPositionDistanceLast5VS.setOpacity(0);
+    }
+
+    public void setAvgPositionDistanceLast5(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPositionDistanceLast5.setText(firstValue.toString());
+        this.avgPositionDistanceLast5Compare.setText(compareValue.toString());
+
+        this.avgPositionDistanceLast5Compare.setDisable(false);
+        this.avgPositionDistanceLast5Compare.setOpacity(1);
+
+        this.avgPositionDistanceLast5VS.setDisable(false);
+        this.avgPositionDistanceLast5VS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPositionDistanceLast5.setStyle("-fx-text-fill: green;");
+            this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPositionDistanceLast5.setStyle("-fx-text-fill: red;");
+            this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPositionDistanceLast5.setStyle("-fx-text-fill: black;");
+            this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPositionDistanceLast10(String value) {
+        this.avgPositionDistanceLast10.setText(value);
+
+        this.avgPositionDistanceLast10Compare.setDisable(true);
+        this.avgPositionDistanceLast10Compare.setOpacity(0);
+
+        this.avgPositionDistanceLast10VS.setDisable(true);
+        this.avgPositionDistanceLast10VS.setOpacity(0);
+    }
+
+    public void setAvgPositionDistanceLast10(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPositionDistanceLast10.setText(firstValue.toString());
+        this.avgPositionDistanceLast10Compare.setText(compareValue.toString());
+
+        this.avgPositionDistanceLast10Compare.setDisable(false);
+        this.avgPositionDistanceLast10Compare.setOpacity(1);
+
+        this.avgPositionDistanceLast10VS.setDisable(false);
+        this.avgPositionDistanceLast10VS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPositionDistanceLast10.setStyle("-fx-text-fill: green;");
+            this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPositionDistanceLast10.setStyle("-fx-text-fill: red;");
+            this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPositionDistanceLast10.setStyle("-fx-text-fill: black;");
+            this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: black;");
+        }
+    }
+
+    public void setAvgPositionDistanceLast15(String value) {
+        this.avgPositionDistanceLast15.setText(value);
+
+        this.avgPositionDistanceLast15Compare.setDisable(true);
+        this.avgPositionDistanceLast15Compare.setOpacity(0);
+
+        this.avgPositionDistanceLast15VS.setDisable(true);
+        this.avgPositionDistanceLast15VS.setOpacity(0);
+    }
+
+    public void setAvgPositionDistanceLast15(ResultsDTO firstValue, ResultsDTO compareValue) {
+        this.avgPositionDistanceLast15.setText(firstValue.toString());
+        this.avgPositionDistanceLast15Compare.setText(compareValue.toString());
+
+        this.avgPositionDistanceLast15Compare.setDisable(false);
+        this.avgPositionDistanceLast15Compare.setOpacity(1);
+
+        this.avgPositionDistanceLast15VS.setDisable(false);
+        this.avgPositionDistanceLast15VS.setOpacity(1);
+        if (firstValue.getRes() < compareValue.getRes()) {
+            this.avgPositionDistanceLast15.setStyle("-fx-text-fill: green;");
+            this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: red;");
+        } else if (firstValue.getRes() > compareValue.getRes()) {
+            this.avgPositionDistanceLast15.setStyle("-fx-text-fill: red;");
+            this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: green;");
+        } else {
+            this.avgPositionDistanceLast15.setStyle("-fx-text-fill: black;");
+            this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: black;");
+        }
+    }
 }

+ 37 - 36
ATG/src/controllers/NewTab/HorseController.java

@@ -6,6 +6,7 @@ import java.util.ResourceBundle;
 import javafx.fxml.FXML;
 import javafx.fxml.Initializable;
 import javafx.scene.control.Label;
+import objects.ResultsDTO;
 
 public class HorseController implements Initializable {
 
@@ -74,7 +75,7 @@ public class HorseController implements Initializable {
         this.avgTimeLabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeLabel(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeLabel(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeLabel.setText(firstValue.toString());
         this.avgTimeLabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeLabelCompare.setText(compareValue.toString());
@@ -84,10 +85,10 @@ public class HorseController implements Initializable {
 
         this.avgTimeLabelTotal.setDisable(false);
         this.avgTimeLabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeLabel.setStyle("-fx-text-fill: green;");
             this.avgTimeLabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeLabel.setStyle("-fx-text-fill: red;");
             this.avgTimeLabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -106,7 +107,7 @@ public class HorseController implements Initializable {
         this.avgTimeDistanceLimit5LabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistance5LabelWithCompare(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistance5LabelWithCompare(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLimit5Label.setText(firstValue.toString());
         this.avgTimeDistanceLimit5LabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLimit5LabelCompare.setText(compareValue.toString());
@@ -116,10 +117,10 @@ public class HorseController implements Initializable {
 
         this.avgTimeDistanceLimit5LabelTotal.setDisable(false);
         this.avgTimeDistanceLimit5LabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLimit5Label.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLimit5LabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -137,7 +138,7 @@ public class HorseController implements Initializable {
         this.avgTimeDistanceLabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLabel(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistanceLabel(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLabel.setText(firstValue.toString());
         this.avgTimeDistanceLabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLabelCompare.setText(compareValue.toString());
@@ -147,10 +148,10 @@ public class HorseController implements Initializable {
 
         this.avgTimeDistanceLabelTotal.setDisable(false);
         this.avgTimeDistanceLabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLabel.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLabel.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -169,7 +170,7 @@ public class HorseController implements Initializable {
         this.avgTimeDistanceLimit10LabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLimit10Label(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistanceLimit10Label(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLimit10Label.setText(firstValue.toString());
         this.avgTimeDistanceLimit10LabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLimit10LabelCompare.setText(compareValue.toString());
@@ -179,10 +180,10 @@ public class HorseController implements Initializable {
 
         this.avgTimeDistanceLimit10LabelTotal.setDisable(false);
         this.avgTimeDistanceLimit10LabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLimit10Label.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLimit10LabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -201,7 +202,7 @@ public class HorseController implements Initializable {
         this.avgTimeDistanceLimit15LabelTotal.setOpacity(0);
     }
 
-    public void setAvgTimeDistanceLimit15Label(Float firstValue, Float globalAvg, Float compareValue) {
+    public void setAvgTimeDistanceLimit15Label(ResultsDTO firstValue, Float globalAvg, ResultsDTO compareValue) {
         this.avgTimeDistanceLimit15Label.setText(firstValue.toString());
         this.avgTimeDistanceLimit15LabelTotal.setText(" (" + globalAvg.toString() + ") ");
         this.avgTimeDistanceLimit15LabelCompare.setText(compareValue.toString());
@@ -211,10 +212,10 @@ public class HorseController implements Initializable {
 
         this.avgTimeDistanceLimit15LabelTotal.setDisable(false);
         this.avgTimeDistanceLimit15LabelTotal.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: green;");
             this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgTimeDistanceLimit15Label.setStyle("-fx-text-fill: red;");
             this.avgTimeDistanceLimit15LabelCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -233,7 +234,7 @@ public class HorseController implements Initializable {
         this.avgPositionVS.setOpacity(0);
     }
 
-    public void setAvgPosition(Float firstValue, Float compareValue) {
+    public void setAvgPosition(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPosition.setText(firstValue.toString());
         this.avgPositionCompare.setText(compareValue.toString());
 
@@ -242,10 +243,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionVS.setDisable(false);
         this.avgPositionVS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPosition.setStyle("-fx-text-fill: green;");
             this.avgPositionCompare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPosition.setStyle("-fx-text-fill: red;");
             this.avgPositionCompare.setStyle("-fx-text-fill: green;");
         } else {
@@ -264,7 +265,7 @@ public class HorseController implements Initializable {
         this.avgPositionLast5VS.setOpacity(0);
     }
 
-    public void setAvgPositionLast5(Float firstValue, Float compareValue) {
+    public void setAvgPositionLast5(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionLast5.setText(firstValue.toString());
         this.avgPositionLast5Compare.setText(compareValue.toString());
 
@@ -273,10 +274,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionLast5VS.setDisable(false);
         this.avgPositionLast5VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionLast5.setStyle("-fx-text-fill: green;");
             this.avgPositionLast5Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionLast5.setStyle("-fx-text-fill: red;");
             this.avgPositionLast5Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -295,7 +296,7 @@ public class HorseController implements Initializable {
         this.avgPositionLast10VS.setOpacity(0);
     }
 
-    public void setAvgPositionLast10(Float firstValue, Float compareValue) {
+    public void setAvgPositionLast10(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionLast10.setText(firstValue.toString());
         this.avgPositionLast10Compare.setText(compareValue.toString());
 
@@ -304,10 +305,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionLast10VS.setDisable(false);
         this.avgPositionLast10VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionLast10.setStyle("-fx-text-fill: green;");
             this.avgPositionLast10Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionLast10.setStyle("-fx-text-fill: red;");
             this.avgPositionLast10Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -326,7 +327,7 @@ public class HorseController implements Initializable {
         this.avgPositionLast15VS.setOpacity(0);
     }
 
-    public void setAvgPositionLast15(Float firstValue, Float compareValue) {
+    public void setAvgPositionLast15(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionLast15.setText(firstValue.toString());
         this.avgPositionLast15Compare.setText(compareValue.toString());
 
@@ -335,10 +336,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionLast15VS.setDisable(false);
         this.avgPositionLast15VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionLast15.setStyle("-fx-text-fill: green;");
             this.avgPositionLast15Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionLast15.setStyle("-fx-text-fill: red;");
             this.avgPositionLast15Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -357,7 +358,7 @@ public class HorseController implements Initializable {
         this.avgPositionDistanceLast5VS.setOpacity(0);
     }
 
-    public void setAvgPositionDistanceLast5(Float firstValue, Float compareValue) {
+    public void setAvgPositionDistanceLast5(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionDistanceLast5.setText(firstValue.toString());
         this.avgPositionDistanceLast5Compare.setText(compareValue.toString());
 
@@ -366,10 +367,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionDistanceLast5VS.setDisable(false);
         this.avgPositionDistanceLast5VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionDistanceLast5.setStyle("-fx-text-fill: green;");
             this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionDistanceLast5.setStyle("-fx-text-fill: red;");
             this.avgPositionDistanceLast5Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -388,7 +389,7 @@ public class HorseController implements Initializable {
         this.avgPositionDistanceLast10VS.setOpacity(0);
     }
 
-    public void setAvgPositionDistanceLast10(Float firstValue, Float compareValue) {
+    public void setAvgPositionDistanceLast10(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionDistanceLast10.setText(firstValue.toString());
         this.avgPositionDistanceLast10Compare.setText(compareValue.toString());
 
@@ -397,10 +398,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionDistanceLast10VS.setDisable(false);
         this.avgPositionDistanceLast10VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionDistanceLast10.setStyle("-fx-text-fill: green;");
             this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionDistanceLast10.setStyle("-fx-text-fill: red;");
             this.avgPositionDistanceLast10Compare.setStyle("-fx-text-fill: green;");
         } else {
@@ -419,7 +420,7 @@ public class HorseController implements Initializable {
         this.avgPositionDistanceLast15VS.setOpacity(0);
     }
 
-    public void setAvgPositionDistanceLast15(Float firstValue, Float compareValue) {
+    public void setAvgPositionDistanceLast15(ResultsDTO firstValue, ResultsDTO compareValue) {
         this.avgPositionDistanceLast15.setText(firstValue.toString());
         this.avgPositionDistanceLast15Compare.setText(compareValue.toString());
 
@@ -428,10 +429,10 @@ public class HorseController implements Initializable {
 
         this.avgPositionDistanceLast15VS.setDisable(false);
         this.avgPositionDistanceLast15VS.setOpacity(1);
-        if (firstValue < compareValue) {
+        if (firstValue.getRes() < compareValue.getRes()) {
             this.avgPositionDistanceLast15.setStyle("-fx-text-fill: green;");
             this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: red;");
-        } else if (firstValue > compareValue) {
+        } else if (firstValue.getRes() > compareValue.getRes()) {
             this.avgPositionDistanceLast15.setStyle("-fx-text-fill: red;");
             this.avgPositionDistanceLast15Compare.setStyle("-fx-text-fill: green;");
         } else {

+ 24 - 20
ATG/src/database/DriverDB.java

@@ -4,6 +4,8 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import objects.ResultsDTO;
+
 public class DriverDB extends Database {
 
     private static DriverDB instance = new DriverDB();
@@ -62,22 +64,22 @@ public class DriverDB extends Database {
         return returnValue;
     }
 
-    public float avarageTime(int driverId) {
-        return avarageTimeByDistance(driverId, 0, 0);
+    public ResultsDTO avarageTime(int driverId, String date) {
+        return avarageTimeByDistance(driverId, 0, 0, date);
     }
 
-    public float avarageTimeByDistance(int driverId, int distance) {
-        return avarageTimeByDistance(driverId, distance, 0);
+    public ResultsDTO avarageTimeByDistance(int driverId, int distance, String date) {
+        return avarageTimeByDistance(driverId, distance, 0, date);
     }
 
-    public float avarageTimeWithLimit(int driverId, int raceLimit) {
-        return avaragePlacementByDistance(driverId, 0, raceLimit);
+    public ResultsDTO avarageTimeWithLimit(int driverId, int raceLimit, String date) {
+        return avaragePlacementByDistance(driverId, 0, raceLimit, date);
     }
 
-    public float avarageTimeByDistance(int driverId, int distance, int raceLimit) {
-        float returnValue = -1f;
+    public ResultsDTO avarageTimeByDistance(int driverId, int distance, int raceLimit, String date) {
+        final ResultsDTO returnValue = new ResultsDTO();
         final String sql
-                = "SELECT ROUND(AVG(avgRes.Time), 2) as avgTime FROM (SELECT Time FROM Results WHERE Time > 0 AND Lane > 0 AND RaceDate < NOW() AND DriverId = ?";
+                = "SELECT ROUND(AVG(avgRes.Time), 2) as avgTime, count(*) as num FROM (SELECT Time FROM Results WHERE Time > 0 AND Lane > 0 AND RaceDate < NOW() AND DriverId = ?";
         final String distanceSql = " AND distance BETWEEN ? AND ?";
         final String limitSql = " LIMIT ?";
         final String endingSql = ") avgRes";
@@ -121,7 +123,8 @@ public class DriverDB extends Database {
             final ResultSet rs = stat.executeQuery();
 
             while (rs.next()) {
-                returnValue = rs.getFloat("avgTime");
+                returnValue.setRes(rs.getFloat("avgTime"));
+                returnValue.setCount(rs.getInt("num"));
             }
         } catch (final SQLException e) {
             e.printStackTrace();
@@ -131,25 +134,25 @@ public class DriverDB extends Database {
         return returnValue;
     }
 
-    public float avaragePlacement(int driverId) {
-        return avaragePlacementByDistance(driverId, 0, 0);
+    public ResultsDTO avaragePlacement(int driverId, String date) {
+        return avaragePlacementByDistance(driverId, 0, 0, date);
     }
 
-    public float avaragePlacementByDistance(int driverId, int distance) {
-        return avaragePlacementByDistance(driverId, distance, 0);
+    public ResultsDTO avaragePlacementByDistance(int driverId, int distance, String date) {
+        return avaragePlacementByDistance(driverId, distance, 0, date);
     }
 
-    public float avaragePlacementWithLimit(int driverId, int raceLimit) {
-        return avaragePlacementByDistance(driverId, 0, raceLimit);
+    public ResultsDTO avaragePlacementWithLimit(int driverId, int raceLimit, String date) {
+        return avaragePlacementByDistance(driverId, 0, raceLimit, date);
     }
 
-    public float avaragePlacementByDistance(int driverId, int distance, int raceLimit) {
-        float returnValue = -1;
+    public ResultsDTO avaragePlacementByDistance(int driverId, int distance, int raceLimit, String date) {
+        final ResultsDTO returnValue = new ResultsDTO();
 
         final StringBuilder sb = new StringBuilder();
         final String sql = "SELECT ROUND(avg(" + "CASE " + "WHEN Result = -1 THEN 9 " + "WHEN Result = -2 THEN 10 "
                 + "WHEN Result = 0 THEN 8 " + "ELSE Result " + "END "
-                + "), 2) as avgResult FROM (SELECT Result FROM Results WHERE DriverId = ?";
+                + "), 2) as avgResult, count(*) as num FROM (SELECT Result FROM Results WHERE DriverId = ?";
         final String distSql = " AND distance BETWEEN ? AND ?";
         final String limitSql = " limit ?";
 
@@ -179,7 +182,8 @@ public class DriverDB extends Database {
             final ResultSet rs = stat.executeQuery();
 
             while (rs.next()) {
-                returnValue = rs.getFloat("avgResult");
+                returnValue.setRes(rs.getFloat("avgResult"));
+                returnValue.setCount(rs.getInt("num"));
             }
         } catch (final SQLException e) {
             // TODO Auto-generated catch block

+ 46 - 36
ATG/src/database/Ekipage.java

@@ -4,6 +4,10 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import com.google.common.base.Strings;
+
+import objects.ResultsDTO;
+
 public class Ekipage extends Database {
 
     private static Ekipage instance = new Ekipage();
@@ -15,22 +19,23 @@ public class Ekipage extends Database {
         return instance;
     }
 
-    public float avarageTime(int driverId, int horseId) {
-        return avarageTimeByDistance(driverId, horseId, 0, 0);
+    public ResultsDTO avarageTime(int driverId, int horseId, String date) {
+        return avarageTimeByDistance(driverId, horseId, 0, 0, date);
     }
 
-    public float avarageTimeByDistance(int driverId, int horseId, int distance) {
-        return avarageTimeByDistance(driverId, horseId, distance, 0);
+    public ResultsDTO avarageTimeByDistance(int driverId, int horseId, int distance, String date) {
+        return avarageTimeByDistance(driverId, horseId, distance, 0, date);
     }
 
-    public float avarageTimeWithLimit(int driverId, int horseId, int raceLimit) {
-        return avarageTimeByDistance(driverId, horseId, 0, raceLimit);
+    public ResultsDTO avarageTimeWithLimit(int driverId, int horseId, int raceLimit, String date) {
+        return avarageTimeByDistance(driverId, horseId, 0, raceLimit, date);
     }
 
-    public float avarageTimeByDistance(int driverId, int horseId, int distance, int raceLimit) {
-        float returnValue = -1f;
-        final String sql = "SELECT ROUND(AVG(avgRes.Time), 2) as avgTime FROM (SELECT Time FROM Results "
-                + "WHERE Time > 0 AND Lane > 0 AND RaceDate < NOW() AND DriverId = ? AND horseId = ?";
+    public ResultsDTO avarageTimeByDistance(int driverId, int horseId, int distance, int raceLimit, String date) {
+        final ResultsDTO returnValue = new ResultsDTO();
+        final String d = Strings.isNullOrEmpty(date) ? "NOW()" : date;
+        final String sql = "SELECT ROUND(AVG(avgRes.Time), 2) as avgTime, count(*) as num FROM (SELECT Time FROM Results "
+                + "WHERE Time > 0 AND Lane > 0 AND RaceDate < ? AND DriverId = ? AND horseId = ?";
         final String distanceSql = " AND distance BETWEEN ? AND ?";
         final String limitSql = " LIMIT ?";
         final String endingSql = ") avgRes";
@@ -49,22 +54,24 @@ public class Ekipage extends Database {
 
         try {
             final PreparedStatement stat = getConnection().prepareStatement(sb.toString());
-            stat.setInt(1, driverId);
-            stat.setInt(2, horseId);
+            stat.setString(1, d);
+            stat.setInt(2, driverId);
+            stat.setInt(3, horseId);
             if (distance > 0) {
-                stat.setInt(3, distance - 50);
-                stat.setInt(4, distance + 50);
+                stat.setInt(4, distance - 50);
+                stat.setInt(5, distance + 50);
             }
             if (distance > 0 && raceLimit > 0) {
-                stat.setInt(5, raceLimit);
+                stat.setInt(6, raceLimit);
             } else if (distance <= 0 && raceLimit > 0) {
-                stat.setInt(3, raceLimit);
+                stat.setInt(4, raceLimit);
             }
 
             final ResultSet rs = stat.executeQuery();
 
             while (rs.next()) {
-                returnValue = rs.getFloat("avgTime");
+                returnValue.setRes(rs.getFloat("avgTime"));
+                returnValue.setCount(rs.getInt("num"));
             }
         } catch (final SQLException e) {
             e.printStackTrace();
@@ -74,25 +81,26 @@ public class Ekipage extends Database {
         return returnValue;
     }
 
-    public float avaragePlacement(int driverId, int horseId) {
-        return avaragePlacementByDistance(driverId, horseId, 0, 0);
+    public ResultsDTO avaragePlacement(int driverId, int horseId, String date) {
+        return avaragePlacementByDistance(driverId, horseId, 0, 0, date);
     }
 
-    public float avaragePlacementByDistance(int driverId, int horseId, int distance) {
-        return avaragePlacementByDistance(driverId, horseId, distance, 0);
+    public ResultsDTO avaragePlacementByDistance(int driverId, int horseId, int distance, String date) {
+        return avaragePlacementByDistance(driverId, horseId, distance, 0, date);
     }
 
-    public float avaragePlacementWithLimit(int driverId, int horseId, int raceLimit) {
-        return avaragePlacementByDistance(driverId, horseId, 0, raceLimit);
+    public ResultsDTO avaragePlacementWithLimit(int driverId, int horseId, int raceLimit, String date) {
+        return avaragePlacementByDistance(driverId, horseId, 0, raceLimit, date);
     }
 
-    public float avaragePlacementByDistance(int driverId, int horseId, int distance, int raceLimit) {
-        float returnValue = -1;
+    public ResultsDTO avaragePlacementByDistance(int driverId, int horseId, int distance, int raceLimit, String date) {
+        final ResultsDTO returnValue = new ResultsDTO();
 
+        final String d = Strings.isNullOrEmpty(date) ? "NOW()" : date;
         final StringBuilder sb = new StringBuilder();
-        final String sql = "SELECT ROUND(avg(" + "CASE " + "WHEN Result = -1 THEN 9" + "WHEN Result = -2 THEN 10"
-                + "WHEN Result = 0 THEN 8" + "ELSE Result" + "END"
-                + "), 2) as avgResult FROM (SELECT Result FROM Results WHERE DriverId = ? AND horseId = ?";
+        final String sql = "SELECT ROUND(avg(" + "CASE " + "WHEN Result = -1 THEN 9 WHEN Result = -2 THEN 10"
+                + " WHEN Result = 0 THEN 8" + " ELSE Result " + "END"
+                + " ), 2) as avgResult, count(*) as num FROM (SELECT Result FROM Results WHERE RaceDate < ? AND DriverId = ? AND horseId = ?";
         final String distSql = " AND distance BETWEEN ? AND ?";
         final String limitSql = " limit ?";
 
@@ -104,26 +112,28 @@ public class Ekipage extends Database {
             sb.append(limitSql);
         }
 
-        sb.append(")");
+        sb.append(") as t");
 
         try {
             final PreparedStatement stat = getConnection().prepareStatement(sb.toString());
-            stat.setInt(1, driverId);
-            stat.setInt(2, horseId);
+            stat.setString(1, d);
+            stat.setInt(2, driverId);
+            stat.setInt(3, horseId);
             if (distance > 0) {
-                stat.setInt(3, distance - 50);
-                stat.setInt(4, distance + 50);
+                stat.setInt(4, distance - 50);
+                stat.setInt(5, distance + 50);
             }
             if (distance > 0 && raceLimit > 0) {
-                stat.setInt(5, raceLimit);
+                stat.setInt(6, raceLimit);
             } else if (distance <= 0 && raceLimit > 0) {
-                stat.setInt(3, raceLimit);
+                stat.setInt(4, raceLimit);
             }
 
             final ResultSet rs = stat.executeQuery();
 
             while (rs.next()) {
-                returnValue = rs.getFloat("avgResult");
+                returnValue.setRes(rs.getFloat("avgResult"));
+                returnValue.setCount(rs.getInt("num"));
             }
         } catch (final SQLException e) {
             // TODO Auto-generated catch block

+ 44 - 31
ATG/src/database/Horse.java

@@ -4,6 +4,10 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import com.google.common.base.Strings;
+
+import objects.ResultsDTO;
+
 public class Horse extends Database {
 
     private static Horse instance = new Horse();
@@ -62,22 +66,25 @@ public class Horse extends Database {
         return returnValue;
     }
 
-    public float avarageTime(int horseId) {
-        return avarageTimeByDistance(horseId, 0, 0);
+    public ResultsDTO avarageTime(int horseId, String date) {
+        return avarageTimeByDistance(horseId, 0, 0, date);
     }
 
-    public float avarageTimeByDistance(int horseId, int distance) {
-        return avarageTimeByDistance(horseId, distance, 0);
+    public ResultsDTO avarageTimeByDistance(int horseId, int distance, String date) {
+        return avarageTimeByDistance(horseId, distance, 0, date);
     }
 
-    public float avarageTimeWithLimit(int horseId, int raceLimit) {
-        return avarageTimeByDistance(horseId, 0, raceLimit);
+    public ResultsDTO avarageTimeWithLimit(int horseId, int raceLimit, String date) {
+        return avarageTimeByDistance(horseId, 0, raceLimit, date);
     }
 
-    public float avarageTimeByDistance(int horseId, int distance, int raceLimit) {
-        float returnValue = -1f;
-        final String sql
-                = "SELECT ROUND(AVG(avgRes.Time), 2) as avgTime FROM (SELECT Time as Time FROM Results WHERE Time > 0 AND Lane > 0 AND RaceDate < NOW() AND HorseId = ?";
+    public ResultsDTO avarageTimeByDistance(int horseId, int distance, int raceLimit, String date) {
+        final ResultsDTO returnValue = new ResultsDTO();
+
+        final String d = Strings.isNullOrEmpty(date) ? "NOW()" : date;
+
+        final String sql = "SELECT ROUND(AVG(avgRes.Time), 2) as avgTime, count(*) as num FROM "
+                + "(SELECT Time as Time FROM Results WHERE Time > 0 AND Lane > 0 AND RaceDate < ? AND HorseId = ?";
         final String distanceSql = " AND distance BETWEEN ? AND ?";
         final String limitSql = " LIMIT ?";
         final String endingSql = ") avgRes";
@@ -107,21 +114,23 @@ public class Horse extends Database {
 
         try {
             final PreparedStatement stat = getConnection().prepareStatement(sb.toString());
-            stat.setInt(1, horseId);
+            stat.setString(1, d);
+            stat.setInt(2, horseId);
             if (distance > 0) {
-                stat.setInt(2, distance - 50);
-                stat.setInt(3, distance + 50);
+                stat.setInt(3, distance - 50);
+                stat.setInt(4, distance + 50);
             }
             if (distance > 0 && raceLimit > 0) {
-                stat.setInt(4, raceLimit);
+                stat.setInt(5, raceLimit);
             } else if (distance <= 0 && raceLimit > 0) {
-                stat.setInt(2, raceLimit);
+                stat.setInt(3, raceLimit);
             }
 
             final ResultSet rs = stat.executeQuery();
 
             while (rs.next()) {
-                returnValue = rs.getFloat("avgTime");
+                returnValue.setRes(rs.getFloat("avgTime"));
+                returnValue.setCount(rs.getInt("num"));
             }
         } catch (final SQLException e) {
             e.printStackTrace();
@@ -131,25 +140,27 @@ public class Horse extends Database {
         return returnValue;
     }
 
-    public float avaragePlacement(int horseId) {
-        return avaragePlacementByDistance(horseId, 0, 0);
+    public ResultsDTO avaragePlacement(int horseId, String date) {
+        return avaragePlacementByDistance(horseId, 0, 0, date);
     }
 
-    public float avaragePlacementByDistance(int horseId, int distance) {
-        return avaragePlacementByDistance(horseId, distance, 0);
+    public ResultsDTO avaragePlacementByDistance(int horseId, int distance, String date) {
+        return avaragePlacementByDistance(horseId, distance, 0, date);
     }
 
-    public float avaragePlacementWithLimit(int horseId, int raceLimit) {
-        return avaragePlacementByDistance(horseId, 0, raceLimit);
+    public ResultsDTO avaragePlacementWithLimit(int horseId, int raceLimit, String date) {
+        return avaragePlacementByDistance(horseId, 0, raceLimit, date);
     }
 
-    public float avaragePlacementByDistance(int horseId, int distance, int raceLimit) {
-        float returnValue = -1;
+    public ResultsDTO avaragePlacementByDistance(int horseId, int distance, int raceLimit, String date) {
+        final ResultsDTO returnValue = new ResultsDTO();
+
+        final String d = Strings.isNullOrEmpty(date) ? "NOW()" : date;
 
         final StringBuilder sb = new StringBuilder();
         final String sql = "SELECT ROUND(avg(" + "CASE " + "WHEN Result = -1 THEN 9 WHEN Result = -2 THEN 10 "
                 + "WHEN Result = 0 THEN 8 ELSE Result END"
-                + "), 2) as avgResult FROM (SELECT Result FROM Results WHERE RaceDate < DATE(NOW()) AND HorseId = ?";
+                + "), 2) as avgResult, count(*) as num FROM (SELECT Result FROM Results WHERE RaceDate < DATE(?) AND HorseId = ?";
         final String distSql = " AND distance BETWEEN ? AND ?";
         final String limitSql = " limit ?";
         final String orderBySql = " ORDER BY RaceDate DESC";
@@ -177,21 +188,23 @@ public class Horse extends Database {
 
         try {
             final PreparedStatement stat = getConnection().prepareStatement(sb.toString());
-            stat.setInt(1, horseId);
+            stat.setString(1, d);
+            stat.setInt(2, horseId);
             if (distance > 0) {
-                stat.setInt(2, distance - 50);
-                stat.setInt(3, distance + 50);
+                stat.setInt(3, distance - 50);
+                stat.setInt(4, distance + 50);
             }
             if (distance > 0 && raceLimit > 0) {
-                stat.setInt(4, raceLimit);
+                stat.setInt(5, raceLimit);
             } else if (distance <= 0 && raceLimit > 0) {
-                stat.setInt(2, raceLimit);
+                stat.setInt(3, raceLimit);
             }
 
             final ResultSet rs = stat.executeQuery();
 
             while (rs.next()) {
-                returnValue = rs.getFloat("avgResult");
+                returnValue.setRes(rs.getFloat("avgResult"));
+                returnValue.setCount(rs.getInt("num"));
             }
         } catch (final SQLException e) {
             e.printStackTrace();

+ 121 - 11
ATG/src/fxml/NewTab/Ekipage.fxml

@@ -3,32 +3,142 @@
 <?import javafx.scene.control.Label?>
 <?import javafx.scene.layout.AnchorPane?>
 <?import javafx.scene.layout.ColumnConstraints?>
+<?import javafx.scene.layout.FlowPane?>
 <?import javafx.scene.layout.GridPane?>
 <?import javafx.scene.layout.RowConstraints?>
+<?import javafx.scene.text.Font?>
 
 <AnchorPane xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.NewTab.EkipageController">
-   <GridPane>
+  <GridPane>
      <columnConstraints>
-       <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
-       <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
+       <ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
+       <ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
      </columnConstraints>
      <rowConstraints>
-       <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-       <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-       <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
+       <RowConstraints vgrow="ALWAYS" />
+       <RowConstraints maxHeight="1.7976931348623157E308" />
+       <RowConstraints vgrow="ALWAYS" />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
+         <RowConstraints />
      </rowConstraints>
       <children>
          <Label text="Ekipage" textAlignment="CENTER" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
+         <Label alignment="CENTER" text="TIME" textAlignment="CENTER" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER">
+            <font>
+               <Font name="System Bold" size="14.0" />
+            </font></Label>
+         <Label fx:id="ekipageNameLabel" text="&lt;EkipageName&gt;" />
                   <Label text="Avg Time (all)" GridPane.rowIndex="2" />
-         <Label fx:id="avgTimeLabel" text="&lt;Avg Time&gt;" GridPane.columnIndex="1" GridPane.rowIndex="2" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="2">
+            <children>
+               <Label fx:id="avgTimeLabel" text="&lt;Avg Time&gt;" />
+               <Label fx:id="avgTimeLabelTotal" text="Label" />
+               <Label fx:id="avgTimeLabelCompare" text="Label" />
+            </children>
+         </FlowPane>
          <Label text="avgTimeDistance (all)" GridPane.rowIndex="3" />
-         <Label fx:id="avgTimeDistanceLabel" text="&lt;Avg Time Distance&gt;" GridPane.columnIndex="1" GridPane.rowIndex="3" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="3">
+            <children>
+               <Label fx:id="avgTimeDistanceLabel" text="&lt;Avg Time Distance&gt;" />
+               <Label fx:id="avgTimeDistanceLabelTotal" text="Label" />
+               <Label fx:id="avgTimeDistanceLabelCompare" text="Label" />
+            </children>
+         </FlowPane>
          <Label text="avgTimeDistanceLimit5 (all)" GridPane.rowIndex="4" />
-         <Label fx:id="avgTimeDistanceLimit5Label" text="&lt;Avg Time Distance limit 5&gt;" GridPane.columnIndex="1" GridPane.rowIndex="4" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="4">
+            <children>
+               <Label fx:id="avgTimeDistanceLimit5Label" text="&lt;Avg Time Distance limit 5&gt;" />
+               <Label fx:id="avgTimeDistanceLimit5LabelTotal" text="Label" />
+               <Label fx:id="avgTimeDistanceLimit5LabelCompare" text="Label" />
+            </children>
+         </FlowPane>
          <Label text="avgTimeDistanceLimit10 (all)" GridPane.rowIndex="5" />
-         <Label fx:id="avgTimeDistanceLimit10Label" text="&lt;Avg Time Distance limit 10&gt;" GridPane.columnIndex="1" GridPane.rowIndex="5" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="5">
+            <children>
+               <Label fx:id="avgTimeDistanceLimit10Label" text="&lt;Avg Time Distance limit 10&gt;" />
+               <Label fx:id="avgTimeDistanceLimit10LabelTotal" text="Label" />
+               <Label fx:id="avgTimeDistanceLimit10LabelCompare" text="Label" />
+            </children>
+         </FlowPane>
          <Label text="avgTimeDistanceLimit15 (all)" GridPane.rowIndex="6" />
-         <Label fx:id="avgTimeDistanceLimit15Label" text="&lt;Avg Time Distance limit 15&gt;" GridPane.columnIndex="1" GridPane.rowIndex="6" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="6">
+            <children>
+               <Label fx:id="avgTimeDistanceLimit15Label" text="&lt;Avg Time Distance limit 15&gt;" />
+               <Label fx:id="avgTimeDistanceLimit15LabelTotal" text="Label" />
+               <Label fx:id="avgTimeDistanceLimit15LabelCompare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label alignment="CENTER" text="POSITION" textAlignment="CENTER" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.rowIndex="7" GridPane.valignment="CENTER">
+            <font>
+               <Font name="System Bold" size="14.0" />
+            </font>
+         </Label>
+         <Label text="Avarage position" GridPane.rowIndex="8" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="8">
+            <children>
+               <Label fx:id="avgPosition" text="&lt;Avg Position&gt;" />
+               <Label fx:id="avgPositionVS" text=" VS " />
+               <Label fx:id="avgPositionCompare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label text="Avg Position Last 5" GridPane.rowIndex="9" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="9">
+            <children>
+               <Label fx:id="avgPositionLast5" text="&lt;Avg Position Last 5&gt;" />
+               <Label fx:id="avgPositionLast5VS" text=" VS " />
+               <Label fx:id="avgPositionLast5Compare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label text="Avg Position Last 10" GridPane.rowIndex="10" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="10">
+            <children>
+               <Label fx:id="avgPositionLast10" text="&lt;Avg Position Last 10&gt;" />
+               <Label fx:id="avgPositionLast10VS" text=" VS " />
+               <Label fx:id="avgPositionLast10Compare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label text="Avg Position Last 15" GridPane.rowIndex="11" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="11">
+            <children>
+               <Label fx:id="avgPositionLast15" text="&lt;Avg Position Last 15&gt;" />
+               <Label fx:id="avgPositionLast15VS" text=" VS " />
+               <Label fx:id="avgPositionLast15Compare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label text="Avg Position Distance Last 5" GridPane.rowIndex="12" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="12">
+            <children>
+               <Label fx:id="avgPositionDistanceLast5" text="&lt;Avg Position Distance Last 5&gt;" />
+               <Label fx:id="avgPositionDistanceLast5VS" text=" VS " />
+               <Label fx:id="avgPositionDistanceLast5Compare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label text="Avg Position Distance Last 10" GridPane.rowIndex="13" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="13">
+            <children>
+               <Label fx:id="avgPositionDistanceLast10" text="&lt;Avg Position Distance Last 10&gt;" />
+               <Label fx:id="avgPositionDistanceLast10VS" text=" VS " />
+               <Label fx:id="avgPositionDistanceLast10Compare" text="Label" />
+            </children>
+         </FlowPane>
+         <Label text="Avg Position Distance Last 15" GridPane.rowIndex="14" />
+         <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="14">
+            <children>
+               <Label fx:id="avgPositionDistanceLast15" text="&lt;Avg Position Distance Last 15&gt;" />
+               <Label fx:id="avgPositionDistanceLast15VS" text=" VS " />
+               <Label fx:id="avgPositionDistanceLast15Compare" text="Label" />
+            </children>
+         </FlowPane>
       </children>
    </GridPane>
 </AnchorPane>

+ 2 - 2
ATG/src/fxml/NewTab/Horse.fxml

@@ -32,12 +32,12 @@
          <RowConstraints />
      </rowConstraints>
       <children>
-         <Label text="Driver" textAlignment="CENTER" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
+         <Label text="Horse" textAlignment="CENTER" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
          <Label alignment="CENTER" text="TIME" textAlignment="CENTER" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER">
             <font>
                <Font name="System Bold" size="14.0" />
             </font></Label>
-         <Label fx:id="horseNameLabel" text="&lt;DriverName&gt;" />
+         <Label fx:id="horseNameLabel" text="&lt;HorseName&gt;" />
                   <Label text="Avg Time (all)" GridPane.rowIndex="2" />
          <FlowPane GridPane.columnIndex="1" GridPane.rowIndex="2">
             <children>

+ 259 - 132
ATG/src/objects/NewTabRaceTableView.java

@@ -104,180 +104,307 @@ public class NewTabRaceTableView extends Tab {
             if (selectedItems.size() == 2) {
                 final ComparingResultsData firstSel
                         = selectedItems.stream().filter(p -> !p.equals(newSelection)).collect(Collectors.toList()).get(0);
-                horseController.setAvgTimeLabel(horseDb.avarageTime(firstSel.getHorseId()), databaseb.getAvgTime(),
-                        horseDb.avarageTime(newSelection.getHorseId()));
+                horseController.setAvgTimeLabel(horseDb.avarageTime(firstSel.getHorseId(), firstSel.getRaceDate()),
+                        databaseb.getAvgTime(), horseDb.avarageTime(newSelection.getHorseId(), newSelection.getRaceDate()));
 
                 horseController.setAvgTimeDistanceLabel(
-                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance()),
-                        databaseb.getAvgTimeByDistance(newSelection.getDistance()),
-                        horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance()));
+                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistance(newSelection.getDistance()), horseDb.avarageTimeByDistance(
+                                newSelection.getHorseId(), newSelection.getDistance(), newSelection.getRaceDate()));
 
                 horseController.setAvgTimeDistance5LabelWithCompare(
-                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), 5),
-                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5),
-                        horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 5));
+                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), 5, firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5), horseDb.avarageTimeByDistance(
+                                newSelection.getHorseId(), newSelection.getDistance(), 5, newSelection.getRaceDate()));
 
                 horseController.setAvgTimeDistanceLimit10Label(
-                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), 10),
-                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10),
-                        horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 10));
+                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), 10, firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10), horseDb.avarageTimeByDistance(
+                                newSelection.getHorseId(), newSelection.getDistance(), 10, newSelection.getRaceDate()));
                 horseController.setAvgTimeDistanceLimit15Label(
-                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), 15),
-                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15),
-                        horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 15));
-
-                horseController.setAvgPosition(horseDb.avaragePlacement(firstSel.getHorseId()),
-                        horseDb.avaragePlacement(newSelection.getHorseId()));
-                horseController.setAvgPositionLast5(horseDb.avaragePlacementWithLimit(firstSel.getHorseId(), 5),
-                        horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 5));
-
-                horseController.setAvgPositionLast10(horseDb.avaragePlacementWithLimit(firstSel.getHorseId(), 10),
-                        horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 10));
-                horseController.setAvgPositionLast15(horseDb.avaragePlacementWithLimit(firstSel.getHorseId(), 15),
-                        horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 15));
+                        horseDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDistance(), 15, firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15), horseDb.avarageTimeByDistance(
+                                newSelection.getHorseId(), newSelection.getDistance(), 15, newSelection.getRaceDate()));
+
+                horseController.setAvgPosition(horseDb.avaragePlacement(firstSel.getHorseId(), firstSel.getRaceDate()),
+                        horseDb.avaragePlacement(newSelection.getHorseId(), newSelection.getRaceDate()));
+                horseController.setAvgPositionLast5(
+                        horseDb.avaragePlacementWithLimit(firstSel.getHorseId(), 5, firstSel.getRaceDate()),
+                        horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 5, newSelection.getRaceDate()));
+
+                horseController.setAvgPositionLast10(
+                        horseDb.avaragePlacementWithLimit(firstSel.getHorseId(), 10, firstSel.getRaceDate()),
+                        horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 10, newSelection.getRaceDate()));
+                horseController.setAvgPositionLast15(
+                        horseDb.avaragePlacementWithLimit(firstSel.getHorseId(), 15, firstSel.getRaceDate()),
+                        horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 15, newSelection.getRaceDate()));
 
                 horseController.setAvgPositionDistanceLast5(
-                        horseDb.avaragePlacementByDistance(firstSel.getHorseId(), firstSel.getDistance(), 5),
-                        horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 5));
+                        horseDb.avaragePlacementByDistance(firstSel.getHorseId(), firstSel.getDistance(), 5,
+                                firstSel.getRaceDate()),
+                        horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 5,
+                                newSelection.getRaceDate()));
 
                 horseController.setAvgPositionDistanceLast10(
-                        horseDb.avaragePlacementByDistance(firstSel.getHorseId(), firstSel.getDistance(), 10),
-                        horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 10));
+                        horseDb.avaragePlacementByDistance(firstSel.getHorseId(), firstSel.getDistance(), 10,
+                                firstSel.getRaceDate()),
+                        horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 10,
+                                newSelection.getRaceDate()));
 
                 horseController.setAvgPositionDistanceLast15(
-                        horseDb.avaragePlacementByDistance(firstSel.getHorseId(), firstSel.getDistance(), 15),
-                        horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 15));
+                        horseDb.avaragePlacementByDistance(firstSel.getHorseId(), firstSel.getDistance(), 15,
+                                firstSel.getRaceDate()),
+                        horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 15,
+                                newSelection.getRaceDate()));
 
                 // Driver
 
-                driverController.setAvgTimeLabel(driverDb.avarageTime(firstSel.getDriverId()), databaseb.getAvgTime(),
-                        driverDb.avarageTime(newSelection.getDriverId()));
+                driverController.setAvgTimeLabel(driverDb.avarageTime(firstSel.getDriverId(), firstSel.getRaceDate()),
+                        databaseb.getAvgTime(), driverDb.avarageTime(newSelection.getDriverId(), newSelection.getRaceDate()));
 
                 driverController.setAvgTimeDistanceLabel(
-                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance()),
-                        databaseb.getAvgTimeByDistance(newSelection.getDistance()),
-                        driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance()));
+                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistance(newSelection.getDistance()), driverDb.avarageTimeByDistance(
+                                newSelection.getDriverId(), newSelection.getDistance(), newSelection.getRaceDate()));
 
                 driverController.setAvgTimeDistance5LabelWithCompare(
-                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), 5),
-                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5),
-                        driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 5));
+                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), 5, firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5), driverDb.avarageTimeByDistance(
+                                newSelection.getDriverId(), newSelection.getDistance(), 5, newSelection.getRaceDate()));
 
                 driverController.setAvgTimeDistanceLimit10Label(
-                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), 10),
-                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10),
-                        driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 10));
+                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), 10,
+                                firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10), driverDb.avarageTimeByDistance(
+                                newSelection.getDriverId(), newSelection.getDistance(), 10, newSelection.getRaceDate()));
                 driverController.setAvgTimeDistanceLimit15Label(
-                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), 15),
-                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15),
-                        driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 15));
-
-                driverController.setAvgPosition(driverDb.avaragePlacement(firstSel.getDriverId()),
-                        driverDb.avaragePlacement(newSelection.getDriverId()));
-                driverController.setAvgPositionLast5(driverDb.avaragePlacementWithLimit(firstSel.getDriverId(), 5),
-                        driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 5));
-                driverController.setAvgPositionLast10(driverDb.avaragePlacementWithLimit(firstSel.getDriverId(), 10),
-                        driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 10));
-                driverController.setAvgPositionLast15(driverDb.avaragePlacementWithLimit(firstSel.getDriverId(), 15),
-                        driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 15));
+                        driverDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getDistance(), 15,
+                                firstSel.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15), driverDb.avarageTimeByDistance(
+                                newSelection.getDriverId(), newSelection.getDistance(), 15, newSelection.getRaceDate()));
+
+                driverController.setAvgPosition(driverDb.avaragePlacement(firstSel.getDriverId(), firstSel.getRaceDate()),
+                        driverDb.avaragePlacement(newSelection.getDriverId(), newSelection.getRaceDate()));
+                driverController.setAvgPositionLast5(
+                        driverDb.avaragePlacementWithLimit(firstSel.getDriverId(), 5, firstSel.getRaceDate()),
+                        driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 5, newSelection.getRaceDate()));
+                driverController.setAvgPositionLast10(
+                        driverDb.avaragePlacementWithLimit(firstSel.getDriverId(), 10, firstSel.getRaceDate()),
+                        driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 10, newSelection.getRaceDate()));
+                driverController.setAvgPositionLast15(
+                        driverDb.avaragePlacementWithLimit(firstSel.getDriverId(), 15, firstSel.getRaceDate()),
+                        driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 15, newSelection.getRaceDate()));
 
                 driverController.setAvgPositionDistanceLast5(
-                        driverDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getDistance(), 5),
-                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 5));
+                        driverDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getDistance(), 5,
+                                firstSel.getRaceDate()),
+                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 5,
+                                newSelection.getRaceDate()));
 
                 driverController.setAvgPositionDistanceLast10(
-                        driverDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getDistance(), 10),
-                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 10));
+                        driverDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getDistance(), 10,
+                                firstSel.getRaceDate()),
+                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 10,
+                                newSelection.getRaceDate()));
 
                 driverController.setAvgPositionDistanceLast15(
-                        driverDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getDistance(), 15),
-                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 15));
-            } else {
-                horseController.setAvgTimeLabel(String.valueOf(horseDb.avarageTime(newSelection.getHorseId())) + "("
-                        + String.valueOf(databaseb.getAvgTime()) + ")");
-                horseController.setAvgTimeDistanceLabel(
-                        String.valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance())) + "("
-                                + String.valueOf(databaseb.getAvgTimeByDistance(newSelection.getDistance())) + ")");
-                horseController.setAvgTimeDistanceLimit5Label(
-                        String.valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 5))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5)) + ")");
-                horseController.setAvgTimeDistanceLimit10Label(
-                        String.valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 10))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10))
-                                + ")");
-                horseController.setAvgTimeDistanceLimit15Label(
-                        String.valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 15))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15))
-                                + ")");
+                        driverDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getDistance(), 15,
+                                firstSel.getRaceDate()),
+                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 15,
+                                newSelection.getRaceDate()));
 
-                horseController.setAvgPosition(String.valueOf(horseDb.avaragePlacement(newSelection.getHorseId())));
+                // Ekipage
 
-                horseController
-                        .setAvgPositionLast5(String.valueOf(horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 5)));
-                horseController
-                        .setAvgPositionLast10(String.valueOf(horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 10)));
-                horseController
-                        .setAvgPositionLast15(String.valueOf(horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 15)));
+                ekipageController.setAvgTimeLabel(
+                        ekipageDb.avarageTime(firstSel.getDriverId(), firstSel.getHorseId(), firstSel.getRaceDate()),
+                        databaseb.getAvgTime(),
+                        ekipageDb.avarageTime(newSelection.getDriverId(), newSelection.getHorseId(), newSelection.getRaceDate()));
 
-                horseController.setAvgPositionDistanceLast5(String
-                        .valueOf(horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 5)));
-                horseController.setAvgPositionDistanceLast10(String
-                        .valueOf(horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 10)));
-                horseController.setAvgPositionDistanceLast15(String
-                        .valueOf(horseDb.avaragePlacementByDistance(newSelection.getHorseId(), newSelection.getDistance(), 15)));
+                ekipageController.setAvgTimeDistanceLabel(
+                        ekipageDb.avarageTimeByDistance(firstSel.getHorseId(), firstSel.getDriverId(), firstSel.getDistance(),
+                                newSelection.getRaceDate()),
+                        databaseb.getAvgTimeByDistance(newSelection.getDistance()),
+                        ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), firstSel.getRaceDate()));
 
-                driverController.setAvgTimeLabel(String.valueOf(driverDb.avarageTime(newSelection.getDriverId())) + "("
-                        + String.valueOf(databaseb.getAvgTime()) + ")");
-                driverController.setAvgTimeDistanceLabel(
-                        String.valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance()))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistance(newSelection.getDistance())) + ")");
-                driverController.setAvgTimeDistanceLimit5Label(
-                        String.valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 5))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5)) + ")");
-                driverController.setAvgTimeDistanceLimit10Label(
-                        String.valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 10))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10))
-                                + ")");
-                driverController.setAvgTimeDistanceLimit15Label(
-                        String.valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 15))
-                                + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15))
-                                + ")");
-
-                driverController.setAvgPosition(String.valueOf(driverDb.avaragePlacement(newSelection.getDriverId())));
-
-                driverController
-                        .setAvgPositionLast5(String.valueOf(driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 5)));
-                driverController
-                        .setAvgPositionLast10(String.valueOf(driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 10)));
-                driverController
-                        .setAvgPositionLast15(String.valueOf(driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 15)));
-
-                driverController.setAvgPositionDistanceLast5(String
-                        .valueOf(driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 5)));
-                driverController.setAvgPositionDistanceLast10(String.valueOf(
-                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 10)));
-                driverController.setAvgPositionDistanceLast15(String.valueOf(
-                        driverDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getDistance(), 15)));
+                ekipageController.setAvgTimeDistance5LabelWithCompare(
+                        ekipageDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getHorseId(), firstSel.getDistance(), 5,
+                                newSelection.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5),
+                        ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 5, firstSel.getRaceDate()));
 
-                ekipageController.setAvgTimeLabel(
-                        String.valueOf(ekipageDb.avarageTime(newSelection.getDriverId(), newSelection.getHorseId())) + "("
-                                + String.valueOf(ekipageDb.getAvgTime()) + ")");
+                ekipageController.setAvgTimeDistanceLimit10Label(
+                        ekipageDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getHorseId(), firstSel.getDistance(), 10,
+                                newSelection.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10),
+                        ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 10, firstSel.getRaceDate()));
+                ekipageController.setAvgTimeDistanceLimit15Label(
+                        ekipageDb.avarageTimeByDistance(firstSel.getDriverId(), firstSel.getHorseId(), firstSel.getDistance(), 15,
+                                newSelection.getRaceDate()),
+                        databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15),
+                        ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 15, firstSel.getRaceDate()));
+
+                ekipageController.setAvgPosition(
+                        ekipageDb.avaragePlacement(firstSel.getDriverId(), firstSel.getHorseId(), firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacement(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getRaceDate()));
+                ekipageController.setAvgPositionLast5(
+                        ekipageDb.avaragePlacementWithLimit(firstSel.getDriverId(), firstSel.getHorseId(), 5,
+                                firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacementWithLimit(newSelection.getDriverId(), newSelection.getHorseId(), 5,
+                                newSelection.getRaceDate()));
+                ekipageController.setAvgPositionLast10(
+                        ekipageDb.avaragePlacementWithLimit(firstSel.getDriverId(), firstSel.getHorseId(), 10,
+                                firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacementWithLimit(newSelection.getDriverId(), newSelection.getHorseId(), 10,
+                                newSelection.getRaceDate()));
+                ekipageController.setAvgPositionLast15(
+                        ekipageDb.avaragePlacementWithLimit(firstSel.getDriverId(), firstSel.getHorseId(), 15,
+                                firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacementWithLimit(newSelection.getDriverId(), newSelection.getHorseId(), 15,
+                                newSelection.getRaceDate()));
+
+                ekipageController.setAvgPositionDistanceLast5(
+                        ekipageDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getHorseId(),
+                                firstSel.getDistance(), 5, firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 5, newSelection.getRaceDate()));
+
+                ekipageController.setAvgPositionDistanceLast10(
+                        ekipageDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getHorseId(),
+                                firstSel.getDistance(), 10, firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 10, newSelection.getRaceDate()));
+
+                ekipageController.setAvgPositionDistanceLast15(
+                        ekipageDb.avaragePlacementByDistance(firstSel.getDriverId(), firstSel.getHorseId(),
+                                firstSel.getDistance(), 15, firstSel.getRaceDate()),
+                        ekipageDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 15, newSelection.getRaceDate()));
+            } else {
+                horseController.setAvgTimeLabel(
+                        String.valueOf(horseDb.avarageTime(newSelection.getHorseId(), newSelection.getRaceDate())) + "("
+                                + String.valueOf(databaseb.getAvgTime()) + ")");
+                horseController.setAvgTimeDistanceLabel(String
+                        .valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(),
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistance(newSelection.getDistance())) + ")");
+                horseController.setAvgTimeDistanceLimit5Label(String
+                        .valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 5,
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5)) + ")");
+                horseController.setAvgTimeDistanceLimit10Label(String
+                        .valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 10,
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10)) + ")");
+                horseController.setAvgTimeDistanceLimit15Label(String
+                        .valueOf(horseDb.avarageTimeByDistance(newSelection.getHorseId(), newSelection.getDistance(), 15,
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15)) + ")");
+
+                horseController.setAvgPosition(
+                        String.valueOf(horseDb.avaragePlacement(newSelection.getHorseId(), newSelection.getRaceDate())));
+
+                horseController.setAvgPositionLast5(String
+                        .valueOf(horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 5, newSelection.getRaceDate())));
+                horseController.setAvgPositionLast10(String
+                        .valueOf(horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 10, newSelection.getRaceDate())));
+                horseController.setAvgPositionLast15(String
+                        .valueOf(horseDb.avaragePlacementWithLimit(newSelection.getHorseId(), 15, newSelection.getRaceDate())));
+
+                horseController
+                        .setAvgPositionDistanceLast5(String.valueOf(horseDb.avaragePlacementByDistance(newSelection.getHorseId(),
+                                newSelection.getDistance(), 5, newSelection.getRaceDate())));
+                horseController
+                        .setAvgPositionDistanceLast10(String.valueOf(horseDb.avaragePlacementByDistance(newSelection.getHorseId(),
+                                newSelection.getDistance(), 10, newSelection.getRaceDate())));
+                horseController
+                        .setAvgPositionDistanceLast15(String.valueOf(horseDb.avaragePlacementByDistance(newSelection.getHorseId(),
+                                newSelection.getDistance(), 15, newSelection.getRaceDate())));
+
+                driverController.setAvgTimeLabel(
+                        String.valueOf(driverDb.avarageTime(newSelection.getDriverId(), newSelection.getRaceDate())) + "("
+                                + String.valueOf(databaseb.getAvgTime()) + ")");
+                driverController.setAvgTimeDistanceLabel(String
+                        .valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(),
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistance(newSelection.getDistance())) + ")");
+                driverController.setAvgTimeDistanceLimit5Label(String
+                        .valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 5,
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5)) + ")");
+                driverController.setAvgTimeDistanceLimit10Label(String
+                        .valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 10,
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10)) + ")");
+                driverController.setAvgTimeDistanceLimit15Label(String
+                        .valueOf(driverDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getDistance(), 15,
+                                newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15)) + ")");
+
+                driverController.setAvgPosition(
+                        String.valueOf(driverDb.avaragePlacement(newSelection.getDriverId(), newSelection.getRaceDate())));
+
+                driverController.setAvgPositionLast5(String
+                        .valueOf(driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 5, newSelection.getRaceDate())));
+                driverController.setAvgPositionLast10(String
+                        .valueOf(driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 10, newSelection.getRaceDate())));
+                driverController.setAvgPositionLast15(String
+                        .valueOf(driverDb.avaragePlacementWithLimit(newSelection.getDriverId(), 15, newSelection.getRaceDate())));
+
+                driverController.setAvgPositionDistanceLast5(String.valueOf(driverDb.avaragePlacementByDistance(
+                        newSelection.getDriverId(), newSelection.getDistance(), 5, newSelection.getRaceDate())));
+                driverController.setAvgPositionDistanceLast10(String.valueOf(driverDb.avaragePlacementByDistance(
+                        newSelection.getDriverId(), newSelection.getDistance(), 10, newSelection.getRaceDate())));
+                driverController.setAvgPositionDistanceLast15(String.valueOf(driverDb.avaragePlacementByDistance(
+                        newSelection.getDriverId(), newSelection.getDistance(), 15, newSelection.getRaceDate())));
+
+                ekipageController.setAvgTimeLabel(String.valueOf(
+                        ekipageDb.avarageTime(newSelection.getDriverId(), newSelection.getHorseId(), newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTime()) + ")");
                 ekipageController.setAvgTimeDistanceLabel(String
                         .valueOf(ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
-                                newSelection.getDistance()))
-                        + "(" + String.valueOf(ekipageDb.getAvgTimeByDistance(newSelection.getDistance())) + ")");
+                                newSelection.getDistance(), newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistance(newSelection.getDistance())) + ")");
                 ekipageController.setAvgTimeDistanceLimit5Label(String
                         .valueOf(ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
-                                newSelection.getDistance(), 5))
-                        + "(" + String.valueOf(ekipageDb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5)) + ")");
+                                newSelection.getDistance(), 5, newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 5)) + ")");
                 ekipageController.setAvgTimeDistanceLimit10Label(String
                         .valueOf(ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
-                                newSelection.getDistance(), 10))
-                        + "(" + String.valueOf(ekipageDb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10)) + ")");
+                                newSelection.getDistance(), 10, newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 10)) + ")");
                 ekipageController.setAvgTimeDistanceLimit15Label(String
                         .valueOf(ekipageDb.avarageTimeByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
-                                newSelection.getDistance(), 15))
-                        + "(" + String.valueOf(ekipageDb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15)) + ")");
+                                newSelection.getDistance(), 15, newSelection.getRaceDate()))
+                        + "(" + String.valueOf(databaseb.getAvgTimeByDistanceLimit(newSelection.getDistance(), 15)) + ")");
+
+                ekipageController.setAvgPosition(String.valueOf(ekipageDb.avaragePlacement(newSelection.getDriverId(),
+                        newSelection.getHorseId(), newSelection.getRaceDate())));
+
+                ekipageController
+                        .setAvgPositionLast5(String.valueOf(ekipageDb.avaragePlacementWithLimit(newSelection.getDriverId(),
+                                newSelection.getHorseId(), 5, newSelection.getRaceDate())));
+                ekipageController
+                        .setAvgPositionLast10(String.valueOf(ekipageDb.avaragePlacementWithLimit(newSelection.getDriverId(),
+                                newSelection.getHorseId(), 10, newSelection.getRaceDate())));
+                ekipageController
+                        .setAvgPositionLast15(String.valueOf(ekipageDb.avaragePlacementWithLimit(newSelection.getDriverId(),
+                                newSelection.getHorseId(), 15, newSelection.getRaceDate())));
+
+                ekipageController.setAvgPositionDistanceLast5(
+                        String.valueOf(ekipageDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 5, newSelection.getRaceDate())));
+                ekipageController.setAvgPositionDistanceLast10(
+                        String.valueOf(ekipageDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 10, newSelection.getRaceDate())));
+                ekipageController.setAvgPositionDistanceLast15(
+                        String.valueOf(ekipageDb.avaragePlacementByDistance(newSelection.getDriverId(), newSelection.getHorseId(),
+                                newSelection.getDistance(), 15, newSelection.getRaceDate())));
+
             }
 
         });

+ 27 - 0
ATG/src/objects/ResultsDTO.java

@@ -0,0 +1,27 @@
+package objects;
+
+public class ResultsDTO {
+    float res;
+    int count;
+
+    public float getRes() {
+        return res;
+    }
+
+    public int getCount() {
+        return count;
+    }
+
+    public void setRes(float res) {
+        this.res = res;
+    }
+
+    public void setCount(int count) {
+        this.count = count;
+    }
+
+    @Override
+    public String toString() {
+        return String.valueOf(res) + "(" + count + ")";
+    }
+}