SEBSERV-422 fixed

This commit is contained in:
anhefti 2023-03-30 14:32:54 +02:00
parent 88a046379f
commit ab9d1f7dcc
4 changed files with 21 additions and 11 deletions

View file

@ -30,23 +30,30 @@ import ch.ethz.seb.sebserver.gbl.util.Utils;
public final class ClientConnection implements GrantEntity { public final class ClientConnection implements GrantEntity {
public enum ConnectionStatus { public enum ConnectionStatus {
UNDEFINED(0, false, false), UNDEFINED(0, false, false, false),
CONNECTION_REQUESTED(1, true, false), CONNECTION_REQUESTED(1, true, false, false),
AUTHENTICATED(2, true, true), AUTHENTICATED(2, true, true, true),
ACTIVE(3, false, true), ACTIVE(3, false, true, true),
CLOSED(4, false, false), CLOSED(4, false, false, true),
DISABLED(5, false, false); DISABLED(5, false, false, false);
public final int code; public final int code;
public final boolean connectingStatus; public final boolean connectingStatus;
public final boolean establishedStatus; public final boolean establishedStatus;
public final boolean clientActiveStatus; 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.code = code;
this.connectingStatus = connectingStatus; this.connectingStatus = connectingStatus;
this.establishedStatus = establishedStatus; this.establishedStatus = establishedStatus;
this.clientActiveStatus = connectingStatus || establishedStatus; this.clientActiveStatus = connectingStatus || establishedStatus;
this.duplicateCheckStatus = duplicateCheckStatus;
} }
} }

View file

@ -354,8 +354,9 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate
} }
}); });
if (!this.toUpdateStatic.isEmpty()) { if (!this.toUpdateStatic.isEmpty() || this.forceUpdateAll) {
fetchStaticClientConnectionData(); fetchStaticClientConnectionData();
this.needsSort = true;
} }
if (!this.toDelete.isEmpty()) { if (!this.toDelete.isEmpty()) {
@ -370,6 +371,7 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate
} }
public void updateGUI() { public void updateGUI() {
if (this.needsSort) { if (this.needsSort) {
sortTable(); sortTable();
} }
@ -652,7 +654,8 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate
} }
int notificationWeight() { 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() { int statusWeight() {

View file

@ -637,7 +637,7 @@ public class ExamSessionServiceImpl implements ExamSessionService {
private ClientConnectionDataInternal getForTokenAndCheckDuplication(final String token) { private ClientConnectionDataInternal getForTokenAndCheckDuplication(final String token) {
final ClientConnectionDataInternal cc = this.examSessionCacheService.getClientConnection(token); final ClientConnectionDataInternal cc = this.examSessionCacheService.getClientConnection(token);
if (cc.clientConnection.status.establishedStatus) { if (cc.clientConnection.status.duplicateCheckStatus) {
final Long id = this.duplicateCheck.put( final Long id = this.duplicateCheck.put(
cc.clientConnection.userSessionId, cc.clientConnection.userSessionId,
cc.getConnectionId()); cc.getConnectionId());

View file

@ -213,7 +213,7 @@ public class APIExceptionHandler extends ResponseEntityExceptionHandler {
final Exception ex, final Exception ex,
final WebRequest request) { 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 return APIMessage.ErrorMessage.GENERIC
.createErrorResponse(ex.getMessage()); .createErrorResponse(ex.getMessage());
} }