From 3911b5a0675ae565826d7dbb2d1d4192d93ed392 Mon Sep 17 00:00:00 2001
From: Pedro Cardona <pedropca@stud.ntnu.no>
Date: Tue, 25 Apr 2023 13:14:19 +0200
Subject: [PATCH] Bug fixed

---
 .../v233/SmartMat/controller/group/GroupController.java         | 2 --
 .../idatt2016/v233/SmartMat/service/group/GroupService.java     | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java
index 85dbbd33..88a6a574 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/controller/group/GroupController.java
@@ -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());
diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/service/group/GroupService.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/service/group/GroupService.java
index 13eb7ba2..e1123705 100644
--- a/src/main/java/ntnu/idatt2016/v233/SmartMat/service/group/GroupService.java
+++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/service/group/GroupService.java
@@ -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();
-- 
GitLab