Compare commits

..

No commits in common. "main" and "gui" have entirely different histories.
main ... gui

9 changed files with 289 additions and 492 deletions

View File

@ -1,3 +0,0 @@
Selim Eser 2211482: Selim Eser, Selim
David Groys 3012642: David Groys
Daniel Zdravkovic 3012893: Daniel Zdravkovic

View File

@ -225,9 +225,6 @@ public class System {
if (!new_password.equals(new_password_authentication)) if (!new_password.equals(new_password_authentication))
return false; return false;
if(old_password.equals(new_password))
return false;
for (int i = 0; i < this.all_user.size(); i++) for (int i = 0; i < this.all_user.size(); i++)
if (this.all_user.get(i).getUsername().equals(current_user.getUsername())) if (this.all_user.get(i).getUsername().equals(current_user.getUsername()))
this.all_user.remove(i); this.all_user.remove(i);
@ -279,8 +276,7 @@ public class System {
String line; String line;
while ((line = reader.readLine()) != null && zip_set.size() < 200) { while ((line = reader.readLine()) != null && zip_set.size() < 200) {
line = line.replace("\"", ""); line = line.replace("\"", "");
if (line.split(";")[0].toUpperCase().startsWith(hometown_or_zip.toUpperCase()) if (line.split(";")[0].contains(hometown_or_zip) || line.split(";")[1].contains(hometown_or_zip))
|| line.split(";")[1].toUpperCase().startsWith(hometown_or_zip.toUpperCase()))
zip_set.add(line); zip_set.add(line);
} }
} catch (Exception e) { } catch (Exception e) {
@ -347,23 +343,12 @@ public class System {
try { try {
HttpClient http_client = HttpClient.newHttpClient(); HttpClient http_client = HttpClient.newHttpClient();
HttpRequest get_request;
if(current_user.getZip().length()<5){ HttpRequest get_request = HttpRequest.newBuilder()
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/weather?q=" + current_user.getHometown()
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET()
.build();
}
else{
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/weather?zip=" + current_user.getZip() .uri(new URI("https://api.openweathermap.org/data/2.5/weather?zip=" + current_user.getZip()
+ ",de&appid=" + api_key + "&units=metric&lang=de")) + ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET() .GET()
.build(); .build();
}
HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString()); HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString());
@ -424,22 +409,12 @@ public class System {
try { try {
HttpClient http_client = HttpClient.newHttpClient(); HttpClient http_client = HttpClient.newHttpClient();
HttpRequest get_request;
if(destination_zip.length()<5){ HttpRequest get_request = HttpRequest.newBuilder()
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/forecast?q=" + search(destination_zip).get(0).split(";")[1]
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET()
.build();
}
else{
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/forecast?zip=" + destination_zip .uri(new URI("https://api.openweathermap.org/data/2.5/forecast?zip=" + destination_zip
+ ",de&appid=" + api_key + "&units=metric&lang=de")) + ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET() .GET()
.build(); .build();
}
HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString()); HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString());

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB