Skip to content
Snippets Groups Projects
Commit 155eba7c authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Exclude duplicate LoggedIn documents from migration

parent e48b912e
No related merge requests found
...@@ -196,6 +196,8 @@ public class V2ToV3Migration implements Migration { ...@@ -196,6 +196,8 @@ public class V2ToV3Migration implements Migration {
if (usernames.contains(loggedInV2.getUser())) { if (usernames.contains(loggedInV2.getUser())) {
continue; continue;
} }
/* There might be rare cases of duplicate LoggedIn records for a user so add them to the filter list */
usernames.add(loggedInV2.getUser());
UserProfile profileV3 = migrator.migrate(null, loggedInV2, loadMotdList(loggedInV2.getUser())); UserProfile profileV3 = migrator.migrate(null, loggedInV2, loadMotdList(loggedInV2.getUser()));
profileV3.setAcknowledgedMotds(migrateMotdIds(profileV3.getAcknowledgedMotds())); profileV3.setAcknowledgedMotds(migrateMotdIds(profileV3.getAcknowledgedMotds()));
profilesV3.add(profileV3); profilesV3.add(profileV3);
...@@ -222,8 +224,9 @@ public class V2ToV3Migration implements Migration { ...@@ -222,8 +224,9 @@ public class V2ToV3Migration implements Migration {
for (de.thm.arsnova.entities.migration.v2.Room roomV2 : roomsV2) { for (de.thm.arsnova.entities.migration.v2.Room roomV2 : roomsV2) {
List<UserProfile> profiles = userRepository.findByLoginId(roomV2.getCreator()); List<UserProfile> profiles = userRepository.findByLoginId(roomV2.getCreator());
if (profiles.size() != 1) { if (profiles.size() == 0) {
throw new Error("Session creator cannot be determined ambiguously."); // Session creator does not exist, skipping: roomV2.getCreator(), roomV2.getId()
continue;
} }
roomsV3.add(migrator.migrate(roomV2, profiles.get(0))); roomsV3.add(migrator.migrate(roomV2, profiles.get(0)));
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment