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.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Table class representing database table plan_worlds.
|
||||
@ -83,9 +81,10 @@ public class WorldTable extends Table {
|
||||
*/
|
||||
public void saveWorlds(Collection<String> worlds) throws SQLException {
|
||||
Verify.nullCheck(worlds);
|
||||
Set<String> worldsToSave = new HashSet<>(worlds);
|
||||
|
||||
List<String> saved = getWorlds();
|
||||
worlds.removeAll(saved);
|
||||
worldsToSave.removeAll(saved);
|
||||
if (Verify.isEmpty(worlds)) {
|
||||
return;
|
||||
}
|
||||
@ -95,7 +94,7 @@ public class WorldTable extends Table {
|
||||
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||
+ columnWorldName
|
||||
+ ") VALUES (?)");
|
||||
for (String world : worlds) {
|
||||
for (String world : worldsToSave) {
|
||||
statement.setString(1, world);
|
||||
statement.addBatch();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user