mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-29 19:41:35 +01:00
Fix Worlds not being saved when WorldTimes are saved.
This commit is contained in:
parent
bff67cd1e5
commit
23bc04c624
@ -13,6 +13,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -63,10 +64,14 @@ public class WorldTimesTable extends UserIDTable {
|
||||
}
|
||||
|
||||
public void saveWorldTimes(UUID uuid, long sessionID, WorldTimes worldTimes) throws SQLException {
|
||||
if (Verify.isEmpty(worldTimes.getWorldTimes())) {
|
||||
Map<String, GMTimes> worldTimesMap = worldTimes.getWorldTimes();
|
||||
if (Verify.isEmpty(worldTimesMap)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<String> worldNames = worldTimesMap.keySet();
|
||||
db.getWorldTable().saveWorlds(worldNames);
|
||||
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = prepareStatement("INSERT INTO " + tableName + " (" +
|
||||
@ -82,7 +87,7 @@ public class WorldTimesTable extends UserIDTable {
|
||||
worldTable.statementSelectID + ", " +
|
||||
"?, ?, ?, ?, ?)");
|
||||
|
||||
for (Map.Entry<String, GMTimes> entry : worldTimes.getWorldTimes().entrySet()) {
|
||||
for (Map.Entry<String, GMTimes> entry : worldTimesMap.entrySet()) {
|
||||
String worldName = entry.getKey();
|
||||
GMTimes gmTimes = entry.getValue();
|
||||
statement.setString(1, uuid.toString());
|
||||
|
@ -352,7 +352,6 @@ public class DatabaseTest {
|
||||
|
||||
@Test
|
||||
public void testSessionSaving() throws SQLException {
|
||||
saveTwoWorlds();
|
||||
saveUserOne();
|
||||
saveUserTwo();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user