Skip to content
Snippets Groups Projects

2.0.0-beta8

Merged Björn Fischer requested to merge develop into main
16 files
+ 58
48
Compare changes
  • Side-by-side
  • Inline
Files
16
@@ -33,29 +33,26 @@ public class LecturerImportService {
}
private User getOrCreateLecturer(Lecturer lecturer) {
User user = null;
if (lecturer.getUser().getHdsName() != null) {
var hdsLoginName = lecturer.getUser().getHdsName();
var user = userRepository.findByLoginNameIgnoreCase(hdsLoginName).orElse(null);
if (user == null) {
user = new User();
user.setLoginName(hdsLoginName);
user.setFirstName(lecturer.getFirstName());
user.setLastName(lecturer.getLastName());
user.setMail(lecturer.getEmail());
}
user = userRepository.findByLoginNameIgnoreCase(hdsLoginName).orElse(null);
}
return userRepository.save(user);
} else {
var user = userRepository.findByMailIgnoreCase(lecturer.getEmail()).orElse(null);
if (user == null) {
user = new User();
user.setFirstName(lecturer.getFirstName());
user.setLastName(lecturer.getLastName());
user.setMail(lecturer.getEmail());
}
if(user == null) {
user = userRepository.findByMailIgnoreCase(lecturer.getEmail()).orElse(null);
}
if (user == null) {
user = new User();
user.setLoginName(lecturer.getUser().getHdsName());
user.setFirstName(lecturer.getFirstName());
user.setLastName(lecturer.getLastName());
user.setMail(lecturer.getEmail());
return userRepository.save(user);
}
return user;
}
private void setLecturers(CourseUnit courseUnit, ArrayList<User> users) {
Loading