Skip to content

Commit

Permalink
SEBSERV-553 fixed show quit link and improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Jun 25, 2024
1 parent 65e7173 commit abe8bcd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ private Exam applyConnectionConfiguration(final Exam exam) {
}

private boolean hasFullIntegration(final Long lmsSetupId) {
// no LMS
if (lmsSetupId == null) {
return false;
}

final LmsAPITemplate lmsAPITemplate = this.lmsAPITemplateCacheService
.getLmsAPITemplate(lmsSetupId)
.getOrThrow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ public Result<Exam> applyConnectionConfiguration(final Exam exam, final byte[] c
final String quizId = MoodleUtils.getQuizId(exam.externalId);
final String fileName = getConnectionConfigFileName(exam);



final MultiValueMap<String, Object> multiPartAttributes = new LinkedMultiValueMap<>();
multiPartAttributes.add("quizid", quizId);
multiPartAttributes.add("name", fileName);
Expand All @@ -259,19 +257,13 @@ public String getFilename() {
}
};

log.info("Upload Connection Configuration to Moodle: quizid: {}, fileName: {}, content: {}", quizId, fileName, contentsAsResource );

multiPartAttributes.add("file", contentsAsResource);

final MoodleAPIRestTemplate rest = getRestTemplate().getOrThrow();
final String response = rest.uploadMultiPart(UPLOAD_ENDPOINT, multiPartAttributes);

if (response != null && (response.startsWith("{\"exception\":") || response.startsWith("0"))) {
log.warn("Failed to apply Connection Configuration to LMS for Exam: {}", exam.externalId);
}

if (response != null && (response.startsWith("{\"warnings\":"))) {
log.info("Moodle warnings in response: {}", response);
if (response != null) {
log.info("Upload Connection Configuration to Moodle: quizid: {}, fileName: {} response: {}", quizId, fileName, response );
}

return exam;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,12 @@ String createSEBSession(
final ScreenProctoringGroup localGroup,
final ClientConnectionRecord clientConnection) {

// TODO check if the Session with token UUID already exists and if true, return the token

final String token = clientConnection.getConnectionToken();
final ScreenProctoringServiceOAuthTemplate apiTemplate = this.getAPITemplate(examId);
final String uri = UriComponentsBuilder
.fromUriString(apiTemplate.spsAPIAccessData.getSpsServiceURL())
.path(SPS_API.SESSION_ENDPOINT)

.build()
.toUriString();

Expand Down Expand Up @@ -983,7 +981,9 @@ private static MultiValueMap<String, String> createExamCreationParams(
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add(SPS_API.EXAM.ATTR_UUID, uuid);
params.add(SPS_API.EXAM.ATTR_NAME, exam.name);
params.add(SPS_API.EXAM.ATTR_DESCRIPTION, exam.getDescription());
if (exam.getDescription() != null) {
params.add(SPS_API.EXAM.ATTR_DESCRIPTION, exam.getDescription());
}
params.add(SPS_API.EXAM.ATTR_URL, exam.getStartURL());
if (!userIds.isEmpty()) {
params.add(SPS_API.EXAM.ATTR_USER_IDS, StringUtils.join(userIds, Constants.LIST_SEPARATOR));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
public class ScreenProctoringServiceImpl implements ScreenProctoringService {

private static final Logger log = LoggerFactory.getLogger(ScreenProctoringServiceImpl.class);

private final Cryptor cryptor;
private final ScreenProctoringAPIBinding screenProctoringAPIBinding;
private final ScreenProctoringGroupDAO screenProctoringGroupDAO;
Expand Down

0 comments on commit abe8bcd

Please sign in to comment.