Skip to content

Commit

Permalink
Simplify keys for students and instructors
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCwy committed Mar 21, 2024
1 parent 5925dc1 commit cbb6e52
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,18 @@ private void migrateDependentEntities(SqlDataBundle sqlDataBundle) {

if (!sqlDataBundle.teams.containsKey(jsonKey)) {
Team sqlTeam = entityConverter.createTeam(student);
sqlDataBundle.teams.put(jsonKey, sqlTeam);
sqlDataBundle.teams.put(k, sqlTeam);
}
});

dataStoreBundle.instructors.forEach((k, instructor) -> {
// Sets instructor key as "courseid-instructorName"
String jsonKey = removeWhitespace(instructor.getCourseId() + "-" + instructor.getName());

if (!sqlDataBundle.instructors.containsKey(jsonKey)) {
Instructor sqlInstructor = entityConverter.convert(instructor);
sqlDataBundle.instructors.put(jsonKey, sqlInstructor);
}
dataStoreBundle.instructors.forEach((k, instructor) -> {
Instructor sqlInstructor = entityConverter.convert(instructor);
sqlDataBundle.instructors.put(k, sqlInstructor);
});

dataStoreBundle.students.forEach((k, student) -> {
// Sets instructor key as "courseid-instructorName"
String jsonKey = removeWhitespace(student.getCourse() + "-" + student.getName());

if (!sqlDataBundle.students.containsKey(jsonKey)) {
Student sqlStudent = entityConverter.convert(student);
sqlDataBundle.students.put(jsonKey, sqlStudent);
}
Student sqlStudent = entityConverter.convert(student);
sqlDataBundle.students.put(k, sqlStudent);
});

dataStoreBundle.deadlineExtensions.forEach((k, deadlineExtension) -> {
Expand Down

0 comments on commit cbb6e52

Please sign in to comment.