Skip to content
Snippets Groups Projects
Commit 79ebd56c authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Add debugging output for Feedback

parent 8b07f4e7
Branches
No related merge requests found
...@@ -20,6 +20,8 @@ package de.thm.arsnova.services; ...@@ -20,6 +20,8 @@ package de.thm.arsnova.services;
import de.thm.arsnova.entities.Feedback; import de.thm.arsnova.entities.Feedback;
import de.thm.arsnova.entities.Room; import de.thm.arsnova.entities.Room;
import de.thm.arsnova.entities.UserAuthentication; import de.thm.arsnova.entities.UserAuthentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -59,6 +61,8 @@ public class FeedbackStorageServiceImpl implements FeedbackStorageService { ...@@ -59,6 +61,8 @@ public class FeedbackStorageServiceImpl implements FeedbackStorageService {
} }
} }
private static final Logger logger = LoggerFactory.getLogger(FeedbackStorageServiceImpl.class);
private final Map<Room, Map<UserAuthentication, FeedbackStorageObject>> data = private final Map<Room, Map<UserAuthentication, FeedbackStorageObject>> data =
new ConcurrentHashMap<>(); new ConcurrentHashMap<>();
...@@ -112,11 +116,16 @@ public class FeedbackStorageServiceImpl implements FeedbackStorageService { ...@@ -112,11 +116,16 @@ public class FeedbackStorageServiceImpl implements FeedbackStorageService {
@Override @Override
@Transactional(isolation = Isolation.READ_COMMITTED) @Transactional(isolation = Isolation.READ_COMMITTED)
public void save(final Room room, final int value, final UserAuthentication user) { public void save(final Room room, final int value, final UserAuthentication user) {
if (data.get(room) == null) { logger.debug("Feedback data for {} Rooms is stored", data.size());
data.put(room, new ConcurrentHashMap<UserAuthentication, FeedbackStorageObject>()); logger.debug("Saving feedback: Room: {}, Value: {}, User: {}", room, value, user);
Map<UserAuthentication, FeedbackStorageObject> roomData = data.get(room);
if (roomData == null) {
logger.debug("Creating new feedback container for Room: {}", room);
roomData = new ConcurrentHashMap<UserAuthentication, FeedbackStorageObject>();
data.put(room, roomData);
} }
logger.debug("Feedback values for Room {}: {}", room.getId(), roomData.size());
data.get(room).put(user, new FeedbackStorageObject(value, user)); roomData.put(user, new FeedbackStorageObject(value, user));
} }
@Override @Override
......
...@@ -147,9 +147,9 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer, Arsnova ...@@ -147,9 +147,9 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer, Arsnova
final de.thm.arsnova.entities.Room room = roomService.getInternal(roomId, u); final de.thm.arsnova.entities.Room room = roomService.getInternal(roomId, u);
if (room.getSettings().isFeedbackLocked()) { if (room.getSettings().isFeedbackLocked()) {
logger.debug("Feedback save blocked: {}", u, roomId, data.getValue()); logger.debug("Feedback ignored: User: {}, Room Id: {}, Feedback: {}", u, roomId, data.getValue());
} else { } else {
logger.debug("Feedback recieved: {}", u, roomId, data.getValue()); logger.debug("Feedback received: User: {}, Room Id: {}, Feedback: {}", u, roomId, data.getValue());
if (null != roomId) { if (null != roomId) {
feedbackService.save(roomId, data.getValue(), u); feedbackService.save(roomId, data.getValue(), u);
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment