From 817f9916f78679dc27af1b8e19997ac34857c18d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20Pirkl?= <pirkl.theo@gmail.com>
Date: Sun, 3 Feb 2019 18:43:45 +0100
Subject: [PATCH] Fix brain

---
 src/main/java/ch/hepia/ui/MainWindowController.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/ch/hepia/ui/MainWindowController.java b/src/main/java/ch/hepia/ui/MainWindowController.java
index c15100e..843c2d3 100644
--- a/src/main/java/ch/hepia/ui/MainWindowController.java
+++ b/src/main/java/ch/hepia/ui/MainWindowController.java
@@ -283,8 +283,10 @@ public class MainWindowController implements Initializable {
         Integer pos = Integer.parseInt(pnl.getId());
         WeatherAPI api = new WeatherAPI();
         Connection connection = displayedConnections.get(pos);
+        System.out.println(connection.getTo().getLocation().getCoordinates());
+
         if (!(currentJourney instanceof Connection.EmptyConnection)){
-            leaveJourney(app, api.getWeatherFrom(connection.getTo().toString()).getConditions());
+            leaveJourney(app, api.getWeatherFrom(connection.getTo().getLocation().getCoordinates()).getConditions());
         }
 
         String weather = api.getWeatherFrom(connection.getTo().toString()).getConditions();
@@ -307,7 +309,7 @@ public class MainWindowController implements Initializable {
             Optional<ButtonType> result = alert.showAndWait();
             if (result.get().equals(oui)){
                 try {
-                    leaveJourney(app, api.getWeatherFrom(connection.getTo().toString()).getConditions());
+                    leaveJourney(app, api.getWeatherFrom(connection.getTo().getLocation().getCoordinates()).getConditions());
                 } catch (IOException e) {
                     showSadMessage(AppConfig.ERROR_API_MQ);
                     e.printStackTrace();
-- 
GitLab