SEBSERV-560 SEBSERV-563 implementation
This commit is contained in:
parent
303b3ac548
commit
e70a209217
3 changed files with 25 additions and 1 deletions
|
@ -79,4 +79,6 @@ public interface ScreenProctoringGroupDAO {
|
|||
Result<Collection<EntityKey>> deleteGroups(Long examId);
|
||||
|
||||
void updateGroupSize(String groupUUID, Integer activeCount, Integer totalCount);
|
||||
|
||||
void resetAllForExam(Long examId);
|
||||
}
|
||||
|
|
|
@ -243,7 +243,8 @@ public class ScreenProctoringGroupDAOImpl implements ScreenProctoringGroupDAO {
|
|||
|
||||
try {
|
||||
|
||||
UpdateDSL.updateWithMapper(
|
||||
UpdateDSL
|
||||
.updateWithMapper(
|
||||
this.screenProctoringGroopRecordMapper::update,
|
||||
ScreenProctoringGroopRecordDynamicSqlSupport.screenProctoringGroopRecord)
|
||||
.set(ScreenProctoringGroopRecordDynamicSqlSupport.size)
|
||||
|
@ -259,6 +260,26 @@ public class ScreenProctoringGroupDAOImpl implements ScreenProctoringGroupDAO {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void resetAllForExam(final Long examId) {
|
||||
try {
|
||||
|
||||
UpdateDSL
|
||||
.updateWithMapper(
|
||||
this.screenProctoringGroopRecordMapper::update,
|
||||
ScreenProctoringGroopRecordDynamicSqlSupport.screenProctoringGroopRecord)
|
||||
.set(ScreenProctoringGroopRecordDynamicSqlSupport.size)
|
||||
.equalTo(0)
|
||||
.where(ScreenProctoringGroopRecordDynamicSqlSupport.examId, isEqualTo(examId))
|
||||
.build()
|
||||
.execute();
|
||||
|
||||
} catch (final Exception e) {
|
||||
log.warn("Failed to reset SPS groups size: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private ScreenProctoringGroup toDomainModel(final ScreenProctoringGroopRecord record) {
|
||||
return new ScreenProctoringGroup(
|
||||
record.getId(),
|
||||
|
|
|
@ -318,6 +318,7 @@ public class ScreenProctoringServiceImpl implements ScreenProctoringService {
|
|||
|
||||
if (event.exam.status != Exam.ExamStatus.UP_COMING) {
|
||||
this.screenProctoringAPIBinding.deactivateScreenProctoring(event.exam);
|
||||
this.screenProctoringGroupDAO.resetAllForExam(event.exam.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue