fixed proctoring room update in connection setup

This commit is contained in:
anhefti 2022-01-04 10:15:01 +01:00
parent 9fbc5bdbc1
commit c863fd0f03
4 changed files with 29 additions and 18 deletions

View file

@ -90,9 +90,6 @@ public interface ClientConnectionDAO extends
* @return Result refer to a collection of all ClientConnection records for update or to an error when happened */
Result<Collection<ClientConnectionRecord>> getAllConnectionIdsForRoomUpdateInactive();
/** Used to re-mark a client connection record for room update in error case. */
void setNeedsRoomUpdate(Long connectionId);
/** Get all ClientConnection that are assigned to a defined proctoring collecting room.
*
* @param roomId The proctoring room identifier
@ -132,6 +129,7 @@ public interface ClientConnectionDAO extends
key = "#connectionToken")
Result<Void> removeFromProctoringRoom(Long connectionId, String connectionToken);
/** Used to re-mark a client connection record for room update in error case. */
Result<Void> markForProctoringUpdate(Long id);
/** Deletes the given ClientConnection data.

View file

@ -285,16 +285,6 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO {
.onError(TransactionHandler::rollback);
}
@Override
@Transactional
public void setNeedsRoomUpdate(final Long connectionId) {
final ClientConnectionRecord updateRecord = new ClientConnectionRecord(
connectionId, null, null, null, null, null,
null, null, null, null, null, null, null,
1);
this.clientConnectionRecordMapper.updateByPrimaryKeySelective(updateRecord);
}
@Override
@Transactional(readOnly = true)
public Result<Collection<ClientConnection>> getRoomConnections(final Long roomId) {

View file

@ -66,22 +66,22 @@ public class MockupLmsAPITemplate implements LmsAPITemplate {
"2020-01-01T09:00:00Z", null, "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz2", institutionId, lmsSetupId, lmsType, "Demo Quiz 2 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
"2020-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
"2020-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz3", institutionId, lmsSetupId, lmsType, "Demo Quiz 3 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
"2018-07-30T09:00:00Z", "2018-08-01T00:00:00Z", "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz4", institutionId, lmsSetupId, lmsType, "Demo Quiz 4 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
"2018-01-01T00:00:00Z", "2019-01-01T00:00:00Z", "http://lms.mockup.com/api/"));
"2018-01-01T00:00:00Z", "2025-01-01T00:00:00Z", "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz5", institutionId, lmsSetupId, lmsType, "Demo Quiz 5 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
"2018-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
"2018-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz6", institutionId, lmsSetupId, lmsType, "Demo Quiz 6 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
"2019-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
"2019-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz7", institutionId, lmsSetupId, lmsType, "Demo Quiz 7 (MOCKUP)", "<p>Demo Quiz Mockup</p>",
"2018-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
"2018-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz10", institutionId, lmsSetupId, lmsType, "Demo Quiz 10 (MOCKUP)",

View file

@ -392,8 +392,15 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic
.save(connectionToSave)
.getOrThrow();
// check exam integrity for established connection
checkExamIntegrity(establishedClientConnection.examId);
// if proctoring is enabled for exam, mark for room update
if (proctoringEnabled) {
this.clientConnectionDAO.markForProctoringUpdate(updatedClientConnection.id);
}
// flush and reload caches to work with actual connection data
final ClientConnectionDataInternal activeClientConnection =
reloadConnectionCache(connectionToken);
@ -493,6 +500,14 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic
updatedClientConnection = clientConnection;
}
// if proctoring is enabled for exam, mark for room update
final Boolean proctoringEnabled = this.examAdminService
.isProctoringEnabled(clientConnection.examId)
.getOr(false);
if (proctoringEnabled) {
this.clientConnectionDAO.markForProctoringUpdate(updatedClientConnection.id);
}
// delete stored ping if this is a distributed setup
if (this.isDistributedSetup) {
this.distributedPingCache
@ -547,6 +562,14 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic
updatedClientConnection = clientConnection;
}
// if proctoring is enabled for exam, mark for room update
final Boolean proctoringEnabled = this.examAdminService
.isProctoringEnabled(clientConnection.examId)
.getOr(false);
if (proctoringEnabled) {
this.clientConnectionDAO.markForProctoringUpdate(updatedClientConnection.id);
}
// delete stored ping if this is a distributed setup
if (this.isDistributedSetup) {
this.distributedPingCache