use of org.olat.course.assessment.model.AssessmentModeImpl in project OpenOLAT by OpenOLAT.
the class AssessmentModeCoordinationServiceImpl method stopAssessment.
@Override
public AssessmentMode stopAssessment(AssessmentMode mode) {
mode = assessmentModeManager.getAssessmentModeById(mode.getKey());
Set<Long> assessedIdentityKeys = assessmentModeManager.getAssessedIdentityKeys(mode);
if (mode.getFollowupTime() > 0) {
Date now = new Date();
Date followupTime = assessmentModeManager.evaluateFollowupTime(now, mode.getFollowupTime());
((AssessmentModeImpl) mode).setEnd(now);
((AssessmentModeImpl) mode).setEndWithFollowupTime(followupTime);
mode.setStatus(Status.followup);
mode = dbInstance.getCurrentEntityManager().merge(mode);
dbInstance.commit();
sendEvent(AssessmentModeNotificationEvent.STOP_ASSESSMENT, mode, assessedIdentityKeys);
} else {
mode = ensureStatusOfMode(mode, Status.end);
sendEvent(AssessmentModeNotificationEvent.END, mode, assessedIdentityKeys);
}
return mode;
}
use of org.olat.course.assessment.model.AssessmentModeImpl in project OpenOLAT by OpenOLAT.
the class AssessmentModeManagerImpl method merge.
@Override
public AssessmentMode merge(AssessmentMode assessmentMode, boolean forceStatus) {
assessmentMode.setLastModified(new Date());
// update begin with lead time
Date begin = assessmentMode.getBegin();
Date beginWithLeadTime = evaluateLeadTime(begin, assessmentMode.getLeadTime());
((AssessmentModeImpl) assessmentMode).setBeginWithLeadTime(beginWithLeadTime);
Date end = assessmentMode.getEnd();
Date endWithFollowupTime = evaluateFollowupTime(end, assessmentMode.getFollowupTime());
((AssessmentModeImpl) assessmentMode).setEndWithFollowupTime(endWithFollowupTime);
AssessmentMode reloadedMode;
if (assessmentMode.getKey() == null) {
dbInstance.getCurrentEntityManager().persist(assessmentMode);
reloadedMode = assessmentMode;
} else {
reloadedMode = dbInstance.getCurrentEntityManager().merge(assessmentMode);
}
dbInstance.commit();
if (reloadedMode.isManualBeginEnd()) {
reloadedMode = assessmentModeCoordinationService.syncManuallySetStatus(reloadedMode, forceStatus);
} else {
reloadedMode = assessmentModeCoordinationService.syncAutomicallySetStatus(reloadedMode);
}
return reloadedMode;
}
use of org.olat.course.assessment.model.AssessmentModeImpl in project OpenOLAT by OpenOLAT.
the class AssessmentModeDAO method delete.
public void delete(AssessmentMode assessmentMode) {
AssessmentModeImpl refMode = dbInstance.getCurrentEntityManager().getReference(AssessmentModeImpl.class, assessmentMode.getKey());
dbInstance.getCurrentEntityManager().remove(refMode);
}
use of org.olat.course.assessment.model.AssessmentModeImpl in project openolat by klemens.
the class AssessmentModeCoordinationServiceImpl method stopAssessment.
@Override
public AssessmentMode stopAssessment(AssessmentMode mode) {
mode = assessmentModeManager.getAssessmentModeById(mode.getKey());
Set<Long> assessedIdentityKeys = assessmentModeManager.getAssessedIdentityKeys(mode);
if (mode.getFollowupTime() > 0) {
Date now = new Date();
Date followupTime = assessmentModeManager.evaluateFollowupTime(now, mode.getFollowupTime());
((AssessmentModeImpl) mode).setEnd(now);
((AssessmentModeImpl) mode).setEndWithFollowupTime(followupTime);
mode.setStatus(Status.followup);
mode = dbInstance.getCurrentEntityManager().merge(mode);
dbInstance.commit();
sendEvent(AssessmentModeNotificationEvent.STOP_ASSESSMENT, mode, assessedIdentityKeys);
} else {
mode = ensureStatusOfMode(mode, Status.end);
sendEvent(AssessmentModeNotificationEvent.END, mode, assessedIdentityKeys);
}
return mode;
}
use of org.olat.course.assessment.model.AssessmentModeImpl in project openolat by klemens.
the class AssessmentModeDAO method delete.
public void delete(AssessmentMode assessmentMode) {
AssessmentModeImpl refMode = dbInstance.getCurrentEntityManager().getReference(AssessmentModeImpl.class, assessmentMode.getKey());
dbInstance.getCurrentEntityManager().remove(refMode);
}
Aggregations