mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Fixed WorldTimes not being saved for sessions for known worlds.
This commit is contained in:
parent
e14e7aeda7
commit
7ee67d4be7
@ -9,9 +9,7 @@ import main.java.com.djrapitops.plan.database.sql.TableSqlParser;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table class representing database table plan_worlds.
|
* Table class representing database table plan_worlds.
|
||||||
@ -83,9 +81,10 @@ public class WorldTable extends Table {
|
|||||||
*/
|
*/
|
||||||
public void saveWorlds(Collection<String> worlds) throws SQLException {
|
public void saveWorlds(Collection<String> worlds) throws SQLException {
|
||||||
Verify.nullCheck(worlds);
|
Verify.nullCheck(worlds);
|
||||||
|
Set<String> worldsToSave = new HashSet<>(worlds);
|
||||||
|
|
||||||
List<String> saved = getWorlds();
|
List<String> saved = getWorlds();
|
||||||
worlds.removeAll(saved);
|
worldsToSave.removeAll(saved);
|
||||||
if (Verify.isEmpty(worlds)) {
|
if (Verify.isEmpty(worlds)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -95,7 +94,7 @@ public class WorldTable extends Table {
|
|||||||
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||||
+ columnWorldName
|
+ columnWorldName
|
||||||
+ ") VALUES (?)");
|
+ ") VALUES (?)");
|
||||||
for (String world : worlds) {
|
for (String world : worldsToSave) {
|
||||||
statement.setString(1, world);
|
statement.setString(1, world);
|
||||||
statement.addBatch();
|
statement.addBatch();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user