Search in sources :

Example 21 with AssessmentEntryImpl

use of org.olat.modules.assessment.model.AssessmentEntryImpl in project openolat by klemens.

the class OLATUpgrade_11_0_0 method processNonPropertiesIQTESTStates.

/**
 * Find if someone has started a test without getting a score, passed status...
 *
 * @param assessableIdentities
 * @param iqNode
 * @param course
 * @param courseEntry
 * @param nodeAssessmentMap
 */
private void processNonPropertiesIQTESTStates(List<Identity> assessableIdentities, IQTESTCourseNode iqNode, ICourse course, RepositoryEntry courseEntry, Map<AssessmentDataKey, AssessmentEntryImpl> nodeAssessmentMap, Map<AssessmentDataKey, AssessmentEntryImpl> curentNodeAssessmentMap) {
    for (Identity assessedIdentity : assessableIdentities) {
        if (iqTestPersisterExists(assessedIdentity, iqNode, course)) {
            AssessmentDataKey key = new AssessmentDataKey(assessedIdentity, course.getResourceableId(), iqNode.getIdent());
            if (curentNodeAssessmentMap.containsKey(key)) {
                continue;
            }
            AssessmentEntryImpl nodeAssessment;
            if (nodeAssessmentMap.containsKey(key)) {
                nodeAssessment = nodeAssessmentMap.get(key);
            } else {
                nodeAssessment = createAssessmentEntry(assessedIdentity, null, course, courseEntry, iqNode.getIdent());
                nodeAssessmentMap.put(key, nodeAssessment);
                Long courseResourceableId = course.getResourceableId();
                String resourcePath = courseResourceableId + File.separator + iqNode.getIdent();
                FilePersister qtiPersister = new FilePersister(assessedIdentity, resourcePath);
                nodeAssessment.setCreationDate(qtiPersister.getLastModified());
                nodeAssessment.setLastModified(qtiPersister.getLastModified());
            }
            nodeAssessment.setAssessmentStatus(AssessmentEntryStatus.inProgress);
        }
    }
}
Also used : FilePersister(org.olat.ims.qti.process.FilePersister) Identity(org.olat.core.id.Identity) TransientIdentity(org.olat.admin.user.imp.TransientIdentity) AssessmentEntryImpl(org.olat.modules.assessment.model.AssessmentEntryImpl)

Example 22 with AssessmentEntryImpl

use of org.olat.modules.assessment.model.AssessmentEntryImpl in project openolat by klemens.

the class AssessmentEntryDAO method createAssessmentEntry.

public AssessmentEntry createAssessmentEntry(Identity assessedIdentity, String anonymousIdentifier, RepositoryEntry entry, String subIdent, RepositoryEntry referenceEntry) {
    AssessmentEntryImpl data = new AssessmentEntryImpl();
    data.setCreationDate(new Date());
    data.setLastModified(data.getCreationDate());
    data.setIdentity(assessedIdentity);
    data.setAnonymousIdentifier(anonymousIdentifier);
    data.setRepositoryEntry(entry);
    data.setSubIdent(subIdent);
    data.setReferenceEntry(referenceEntry);
    data.setUserVisibility(Boolean.TRUE);
    dbInstance.getCurrentEntityManager().persist(data);
    return data;
}
Also used : Date(java.util.Date) AssessmentEntryImpl(org.olat.modules.assessment.model.AssessmentEntryImpl)

Aggregations

AssessmentEntryImpl (org.olat.modules.assessment.model.AssessmentEntryImpl)22 Date (java.util.Date)8 TransientIdentity (org.olat.admin.user.imp.TransientIdentity)8 Identity (org.olat.core.id.Identity)8 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 List (java.util.List)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 ICourse (org.olat.course.ICourse)4 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)4 BasicLTICourseNode (org.olat.course.nodes.BasicLTICourseNode)4 CourseNode (org.olat.course.nodes.CourseNode)4 GTACourseNode (org.olat.course.nodes.GTACourseNode)4 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)4 MSCourseNode (org.olat.course.nodes.MSCourseNode)4 PortfolioCourseNode (org.olat.course.nodes.PortfolioCourseNode)4 STCourseNode (org.olat.course.nodes.STCourseNode)4 ScormCourseNode (org.olat.course.nodes.ScormCourseNode)4 TACourseNode (org.olat.course.nodes.TACourseNode)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4