Search in sources :

Example 1 with AssessmentModeImpl

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;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) Date(java.util.Date)

Example 2 with AssessmentModeImpl

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;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) AssessmentMode(org.olat.course.assessment.AssessmentMode) Date(java.util.Date)

Example 3 with AssessmentModeImpl

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);
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl)

Example 4 with AssessmentModeImpl

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;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) Date(java.util.Date)

Example 5 with AssessmentModeImpl

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);
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl)

Aggregations

AssessmentModeImpl (org.olat.course.assessment.model.AssessmentModeImpl)10 Date (java.util.Date)8 AssessmentMode (org.olat.course.assessment.AssessmentMode)2