Search in sources :

Example 26 with AssessmentChangedEvent

use of org.olat.course.assessment.AssessmentChangedEvent in project openolat by klemens.

the class RunMainController method event.

/**
 * implementation of listener which listens to publish events
 *
 * @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
 */
@Override
public void event(Event event) {
    if (event instanceof PublishEvent) {
        PublishEvent pe = (PublishEvent) event;
        if (course.getResourceableId().equals(pe.getPublishedCourseResId())) {
            processPublishEvent(pe);
        }
    } else if (event instanceof OLATResourceableJustBeforeDeletedEvent) {
        OLATResourceableJustBeforeDeletedEvent ojde = (OLATResourceableJustBeforeDeletedEvent) event;
        // registered only to one event, but good style.
        if (ojde.targetEquals(course, true)) {
            doDisposeAfterEvent();
        }
    } else if (event instanceof AssessmentChangedEvent) {
        AssessmentChangedEvent ace = (AssessmentChangedEvent) event;
        Identity identity = uce.getIdentityEnvironment().getIdentity();
        // reevaluate the changed node if the event changed the current user
        if (ace.getIdentityKey().equals(identity.getKey())) {
            String assessmentChangeType = ace.getCommand();
            // do not re-evaluate things if only comment has been changed
            if (assessmentChangeType.equals(AssessmentChangedEvent.TYPE_SCORE_EVAL_CHANGED) || assessmentChangeType.equals(AssessmentChangedEvent.TYPE_ATTEMPTS_CHANGED)) {
                // LD: do not recalculate the score now, but at the next click, since the event comes before DB commit
                // uce.getScoreAccounting().evaluateAll();
                assessmentChangedEventReceived = true;
            }
            // raise a flag to indicate refresh
            needsRebuildAfterRunDone = true;
        }
    }
}
Also used : PublishEvent(org.olat.course.editor.PublishEvent) AssessmentChangedEvent(org.olat.course.assessment.AssessmentChangedEvent) OLATResourceableJustBeforeDeletedEvent(org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent) Identity(org.olat.core.id.Identity)

Aggregations

AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)26 ICourse (org.olat.course.ICourse)22 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)12 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)12 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)10 Date (java.util.Date)6 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)6 Property (org.olat.properties.Property)6 EfficiencyStatementManager (org.olat.course.assessment.manager.EfficiencyStatementManager)4 CertificateTemplate (org.olat.course.certificate.CertificateTemplate)4 CertificateInfos (org.olat.course.certificate.model.CertificateInfos)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 OLATResourceableJustBeforeDeletedEvent (org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent)2 EfficiencyStatement (org.olat.course.assessment.EfficiencyStatement)2