From ab9d1f7dcc209d7d3c5ed250c827244d7fb9c4e2 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 30 Mar 2023 14:32:54 +0200 Subject: [PATCH] SEBSERV-422 fixed --- .../gbl/model/session/ClientConnection.java | 21 ++++++++++++------- .../session/ClientConnectionTable.java | 7 +++++-- .../session/impl/ExamSessionServiceImpl.java | 2 +- .../weblayer/api/APIExceptionHandler.java | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java index c426e18c..082cc161 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java @@ -30,23 +30,30 @@ import ch.ethz.seb.sebserver.gbl.util.Utils; public final class ClientConnection implements GrantEntity { public enum ConnectionStatus { - UNDEFINED(0, false, false), - CONNECTION_REQUESTED(1, true, false), - AUTHENTICATED(2, true, true), - ACTIVE(3, false, true), - CLOSED(4, false, false), - DISABLED(5, false, false); + UNDEFINED(0, false, false, false), + CONNECTION_REQUESTED(1, true, false, false), + AUTHENTICATED(2, true, true, true), + ACTIVE(3, false, true, true), + CLOSED(4, false, false, true), + DISABLED(5, false, false, false); public final int code; public final boolean connectingStatus; public final boolean establishedStatus; public final boolean clientActiveStatus; + public final boolean duplicateCheckStatus; + + ConnectionStatus( + final int code, + final boolean connectingStatus, + final boolean establishedStatus, + final boolean duplicateCheckStatus) { - ConnectionStatus(final int code, final boolean connectingStatus, final boolean establishedStatus) { this.code = code; this.connectingStatus = connectingStatus; this.establishedStatus = establishedStatus; this.clientActiveStatus = connectingStatus || establishedStatus; + this.duplicateCheckStatus = duplicateCheckStatus; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java index e6f9bbf1..581da9f0 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java @@ -354,8 +354,9 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate } }); - if (!this.toUpdateStatic.isEmpty()) { + if (!this.toUpdateStatic.isEmpty() || this.forceUpdateAll) { fetchStaticClientConnectionData(); + this.needsSort = true; } if (!this.toDelete.isEmpty()) { @@ -370,6 +371,7 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate } public void updateGUI() { + if (this.needsSort) { sortTable(); } @@ -652,7 +654,8 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate } int notificationWeight() { - return BooleanUtils.isTrue(this.monitoringData.pendingNotification) || this.marked ? -1 : 0; + return BooleanUtils.isTrue(this.monitoringData.pendingNotification) || + (this.monitoringData.status.establishedStatus && this.marked) ? -1 : 0; } int statusWeight() { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index 2db525b3..80178cc5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -637,7 +637,7 @@ public class ExamSessionServiceImpl implements ExamSessionService { private ClientConnectionDataInternal getForTokenAndCheckDuplication(final String token) { final ClientConnectionDataInternal cc = this.examSessionCacheService.getClientConnection(token); - if (cc.clientConnection.status.establishedStatus) { + if (cc.clientConnection.status.duplicateCheckStatus) { final Long id = this.duplicateCheck.put( cc.clientConnection.userSessionId, cc.getConnectionId()); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java index a3e2c770..4d0581d2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/APIExceptionHandler.java @@ -213,7 +213,7 @@ public class APIExceptionHandler extends ResponseEntityExceptionHandler { final Exception ex, final WebRequest request) { - log.error("Unexpected generic error catched at the API endpoint: ", ex); + log.error("Unexpected generic error caught at the API endpoint: ", ex); return APIMessage.ErrorMessage.GENERIC .createErrorResponse(ex.getMessage()); }