small bug fixes (major bug fix is coming soon)

This commit is contained in:
potzplitz 2024-05-14 23:31:31 +02:00
parent c723c1b9ff
commit 80dcc5fbf8
4 changed files with 10 additions and 15 deletions

View file

@ -29,7 +29,7 @@ public class DatabaseManager {
public void migrateData() {
Sqlite database = new Sqlite("levels");
FetchData fetch = new FetchData();
status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
status = LoadingStatus.getInstance();
status.initialize();

View file

@ -368,21 +368,17 @@ status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
public void checkColumns(String tablename) {
String[] spalten = {"placement", "levelname", "levelnameRaw", "levelID", "author", "creators", "verifier", "verificationLink", "percentToQualify", "records", "attempts", "completed", "locked", "personalBest", "levelLength"};
// Datenbankverbindung
try (Connection connection = DriverManager.getConnection(url)) {
DatabaseMetaData metaData = connection.getMetaData();
ResultSet resultSet;
int missing = 0;
// Schleife über die Spalten
for (String spalte : spalten) {
// Abfrage der Spalteninformationen
resultSet = metaData.getColumns(null, null, tablename, spalte);
if (!resultSet.next()) {
System.out.println("Spalte " + spalte + " existiert nicht. Eine neue Spalte wird erstellt.");
// Eine neue Spalte erstellen
createNewColumn(tablename, spalte);
missing++;
}

View file

@ -339,7 +339,7 @@ public class MainGUI {
String levellength = data.getLevelLength().get(index);
if(data.getLevelLength().get(index).equals("N/A")) {
if(data.getLevelLength().get(index).equals("N/A") || data.getLevelID().get(index) == null) {
levellength = api.getLevelLength(Integer.parseInt(data.getLevelID().get(index)));
data.modifyData(data.getLevelname().get(index), comp[index], Integer.parseInt(attempts.getText()), lockbool[index], data.getPbarr().get(index), levellength);
System.out.println("request");
@ -399,7 +399,6 @@ public class MainGUI {
if(show.getSelectedIndex() == 1) {
if(!(Integer.parseInt(rank.getName()) >= 0 && Integer.parseInt(rank.getName()) <= 2)) {
levelpanel.remove(contents);
levelpanel.repaint();
levelpanel.revalidate();
}

View file

@ -22,6 +22,10 @@ public class SafeFileManager {
}
public void ReadIndexAttempts() throws IOException {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
read.readAttempts();
@ -40,14 +44,6 @@ public class SafeFileManager {
lengthComp.putAll(read.lengthMap);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
String attempts;
String percent;
String length;
@ -69,7 +65,11 @@ public class SafeFileManager {
prog.update(database.getLevelname().get(i), Integer.parseInt(attempts), Integer.parseInt(percent), i);
if(!database.getLocked().get(i)) {
database.modifyData(database.getLevelname().get(i), Boolean.parseBoolean(database.getCompleted().get(i)), Integer.parseInt(attempts), database.getLocked().get(i), percent, lengthArr[Integer.parseInt(length)]);
} else {
database.modifyData(database.getLevelname().get(i), Boolean.parseBoolean(database.getCompleted().get(i)), database.getAttempts().get(i), database.getLocked().get(i), database.getRecords().get(i), lengthArr[Integer.parseInt(length)]);
}
}
prog.close();
}