Skip to content

Commit 7d2ee1a

Browse files
Konstantin PankratovKonstantin Pankratov
authored andcommitted
Potentially fix bug, where the wrong module was assigned while creation
1 parent 0d9649b commit 7d2ee1a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

server/src/main/java/com/studybuddies/server/web/mapper/MeetingMapperUtils.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ public String userEntityToUUIDString(UserEntity userEntity) {
7272

7373
@Named("assignExistingModule")
7474
public String assignExistingModule(String module) {
75-
var foundModule = moduleCrudService.get();
75+
var foundModules = moduleCrudService.get();
7676

77-
if(!moduleValidationService.exists(module) || foundModule.isEmpty()) {
77+
if(!moduleValidationService.exists(module) || foundModules.isEmpty()) {
7878
throw new ModuleNotFoundException("");
7979
}
80-
return foundModule.get(0).getName().toUpperCase();
80+
var foundModule = foundModules.stream()
81+
.filter(m -> m.getName().equalsIgnoreCase(module))
82+
.findFirst()
83+
.orElseThrow(() -> new ModuleNotFoundException(""));
84+
return foundModule.getName().toUpperCase();
8185
}
8286

8387
private Repeat stringToRepeat(String repeatString) {

0 commit comments

Comments
 (0)