Skip to content
Snippets Groups Projects
Commit 3911b5a0 authored by Pedro Pablo Cardona Arroyave's avatar Pedro Pablo Cardona Arroyave
Browse files

Bug fixed

parent 6683ac6e
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/api/groups")
public class GroupController {
private final GroupService groupService;
private long groupId;
/**
* Gets a group by its name
......@@ -110,7 +109,6 @@ public class GroupController {
*/
@PutMapping("/group/{groupId}/changeOpen")
public ResponseEntity<Boolean> changeOpenValue(@PathVariable("groupId") long groupId) {
this.groupId = groupId;
return groupService.OpenOrCloseGroup(groupId)
.map(ResponseEntity::ok)
.orElseGet(() -> ResponseEntity.notFound().build());
......
......@@ -116,6 +116,7 @@ public class GroupService {
if (answer.isPresent()) {
Group realGroup = answer.get();
realGroup.setOpen(!realGroup.isOpen());
System.out.println(realGroup.isOpen());
return Optional.of(groupRepository.save(realGroup).isOpen());
}
return Optional.empty();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment