Skip to content

Commit

Permalink
SEBSERV-488
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Nov 29, 2023
1 parent 9bda863 commit e426a7a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.function.Consumer;
import java.util.function.Function;

import ch.ethz.seb.sebserver.gbl.FeatureService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -109,6 +110,7 @@ public class MonitoringRunningExam implements TemplateComposer {
private final MonitoringExamSearchPopup monitoringExamSearchPopup;
private final SEBSendLockPopup sebSendLockPopup;
private final MonitoringProctoringService monitoringProctoringService;
private final FeatureService featureService;
private final boolean distributedSetup;
private final long pollInterval;

Expand All @@ -121,6 +123,7 @@ public MonitoringRunningExam(
final SEBSendLockPopup sebSendLockPopup,
final MonitoringProctoringService monitoringProctoringService,
final GuiServiceInfo guiServiceInfo,
final FeatureService featureService,
@Value("${sebserver.gui.webservice.poll-interval:2000}") final long pollInterval) {

this.serverPushService = serverPushService;
Expand All @@ -134,6 +137,7 @@ public MonitoringRunningExam(
this.distributedSetup = guiServiceInfo.isDistributedSetup();
this.monitoringExamSearchPopup = monitoringExamSearchPopup;
this.sebSendLockPopup = sebSendLockPopup;
this.featureService = featureService;
}

@Override
Expand Down Expand Up @@ -315,7 +319,9 @@ private FullPageMonitoringGUIUpdate createProctoringActions(
final PageActionBuilder actionBuilder = this.pageService
.pageActionBuilder(pageContext.clearEntityKeys());

final boolean proctoringEnabled = proctoringSettings != null &&
final boolean spsFeatureEnabled = this.featureService.isEnabled(FeatureService.SCREEN_PROCTORING_FEATURE_NAME);
final boolean proctoringEnabled = spsFeatureEnabled &&
proctoringSettings != null &&
BooleanUtils.toBoolean(proctoringSettings.enableProctoring);
final boolean screenProctoringEnabled = screenProctoringSettings != null &&
BooleanUtils.toBoolean(screenProctoringSettings.enableScreenProctoring);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import ch.ethz.seb.sebserver.webservice.servicelayer.dao.*;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
Expand All @@ -45,11 +46,6 @@
import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ClientNotificationRecordMapper;
import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.ClientEventRecord;
import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.ClientNotificationRecord;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientEventDAO;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.DAOLoggingSupport;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ResourceNotFoundException;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.TransactionHandler;

@Lazy
@Component
Expand Down Expand Up @@ -255,8 +251,9 @@ public Result<ClientNotification> getPendingNotificationByValue(
records);
}

if (records.isEmpty() || records.size() > 1) {
throw new IllegalStateException(
if (records.size() != 1) {
throw new NoResourceFoundException(
EntityType.CLIENT_NOTIFICATION,
"Failed to find pending notification event for confirm:" + notificationValueId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,7 @@ public synchronized Result<Exam> getRunningExam(final Long examId) {
flushCache(exam);
}

if (log.isDebugEnabled()) {
log.info("Exam {} is not currently running", examId);
}

throw new NoSuchElementException(
"No currently running exam found for id: " + examId);
throw new NoSuchElementException("No currently running exam found for id: " + examId);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public String getInstructionJSON(final String connectionToken) {
.append(Constants.CURLY_BRACE_CLOSE)
.toString();

if (log.isDebugEnabled()) {
if (log.isTraceEnabled()) {
log.debug("Send SEB client instruction: {} to: {} ", instructionJSON, connectionToken);
}

Expand Down Expand Up @@ -358,7 +358,7 @@ private ClientInstructionRecord putToCacheIfAbsent(final ClientInstructionRecord
return instruction;
}

if (log.isDebugEnabled()) {
if (log.isTraceEnabled()) {
log.debug("Put SEB instruction into instruction queue: {}", instruction);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Map;
import java.util.Set;

import ch.ethz.seb.sebserver.webservice.servicelayer.dao.NoResourceFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
Expand Down Expand Up @@ -95,6 +96,13 @@ public void confirmPendingNotification(final ClientEvent event) {
.map(this::removeFromCache)
.getOrThrow();

} catch (final NoResourceFoundException e) {
if (log.isDebugEnabled()) {
log.debug(
"Notification already confirmed or removed. connectionId: {}, confirmId: {}",
event.connectionId,
event.getValue());
}
} catch (final Exception e) {
log.error(
"Failed to confirm pending notification from SEB Client side. event: {}", event, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ public Result<Exam> updateExamOnScreenProctoringService(final Long examId) {
return this.examDAO.byPK(examId)
.map(exam -> {

if (log.isDebugEnabled()) {
log.debug("Update changed exam attributes for screen proctoring: {}", exam);
}

final String enabled = exam.additionalAttributes
.get(ScreenProctoringSettings.ATTR_ENABLE_SCREEN_PROCTORING);

Expand Down

0 comments on commit e426a7a

Please sign in to comment.