Search in sources :

Example 46 with AssessmentEntry

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

the class CourseAssessmentManagerImpl method updateCurrentCompletion.

@Override
public void updateCurrentCompletion(CourseNode courseNode, Identity assessedIdentity, UserCourseEnvironment userCourseEnvironment, Double currentCompletion, AssessmentRunStatus runStatus, Role by) {
    AssessmentEntry nodeAssessment = getOrCreate(assessedIdentity, courseNode);
    nodeAssessment.setCurrentRunCompletion(currentCompletion);
    nodeAssessment.setCurrentRunStatus(runStatus);
    if (by == Role.coach) {
        nodeAssessment.setLastCoachModified(new Date());
    } else if (by == Role.user) {
        nodeAssessment.setLastUserModified(new Date());
    }
    assessmentService.updateAssessmentEntry(nodeAssessment);
    DBFactory.getInstance().commit();
}
Also used : AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date)

Example 47 with AssessmentEntry

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

the class CourseAssessmentManagerImpl method saveNodeComment.

@Override
public void saveNodeComment(CourseNode courseNode, Identity identity, Identity assessedIdentity, String comment) {
    ICourse course = CourseFactory.loadCourse(cgm.getCourseEntry());
    AssessmentEntry nodeAssessment = getOrCreate(assessedIdentity, courseNode);
    nodeAssessment.setComment(comment);
    assessmentService.updateAssessmentEntry(nodeAssessment);
    // node log
    UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
    am.appendToUserNodeLog(courseNode, identity, assessedIdentity, "COMMENT set to: " + comment);
    // notify about changes
    AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_USER_COMMENT_CHANGED, assessedIdentity);
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
    // user activity logging
    ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_USERCOMMENT_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiUserComment, "", StringHelper.stripLineBreaks(comment)));
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) AssessmentChangedEvent(org.olat.course.assessment.AssessmentChangedEvent) ICourse(org.olat.course.ICourse) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 48 with AssessmentEntry

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

the class GTANotifications method createAssessmentItem.

private void createAssessmentItem(Task task, Identity assessedIdentity, boolean coach) {
    if (task == null || task.getGraduationDate() == null)
        return;
    if (task.getGraduationDate().after(compareDate)) {
        RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
        AssessmentEntry assessment = courseNodeAssessmentDao.loadAssessmentEntry(assessedIdentity, courseEntry, gtaNode.getIdent());
        boolean resultsVisible = assessment != null && (assessment.getUserVisibility() == null || assessment.getUserVisibility().booleanValue());
        if (resultsVisible) {
            String score = null;
            String status = null;
            if (gtaNode.hasScoreConfigured() && assessment.getScore() != null) {
                score = AssessmentHelper.getRoundedScore(assessment.getScore());
            }
            if (gtaNode.hasPassedConfigured() && assessment.getPassed() != null) {
                status = assessment.getPassed().booleanValue() ? translator.translate("notifications.assessment.passed.true") : translator.translate("notifications.assessment.passed.false");
            }
            Date graduationDate = task.getGraduationDate();
            String[] params = new String[] { getTaskName(task), courseEntry.getDisplayname(), score, status };
            if (score != null && status != null) {
                if (assessment.getPassed().booleanValue()) {
                    appendSubscriptionItem("notifications.assessment.score.passed", params, assessedIdentity, graduationDate, coach);
                } else {
                    appendSubscriptionItem("notifications.assessment.score.notpassed", params, assessedIdentity, graduationDate, coach);
                }
            } else if (score != null) {
                appendSubscriptionItem("notifications.assessment.score", params, assessedIdentity, graduationDate, coach);
            } else if (status != null) {
                appendSubscriptionItem("notifications.assessment.passed", params, assessedIdentity, graduationDate, coach);
            }
            ICourse course = CourseFactory.loadCourse(courseEnv.getCourseGroupManager().getCourseEntry());
            UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            List<File> docs = gtaNode.getIndividualAssessmentDocuments(assessedUserCourseEnv);
            for (File doc : docs) {
                String[] docParams = new String[] { getTaskName(task), courseEntry.getDisplayname(), doc.getName() };
                appendSubscriptionItemForFile("notifications.assessment.doc", docParams, assessedIdentity, "[assessment:0]", doc, graduationDate, coach);
            }
        }
    }
}
Also used : UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File) Date(java.util.Date) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 49 with AssessmentEntry

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

the class QTI21ServiceImpl method deleteAssessmentTestSession.

@Override
public boolean deleteAssessmentTestSession(List<Identity> identities, RepositoryEntryRef testEntry, RepositoryEntryRef entry, String subIdent) {
    Set<AssessmentEntry> entries = new HashSet<>();
    for (Identity identity : identities) {
        List<AssessmentTestSession> sessions = testSessionDao.getTestSessions(testEntry, entry, subIdent, identity);
        for (AssessmentTestSession session : sessions) {
            if (session.getAssessmentEntry() != null) {
                entries.add(session.getAssessmentEntry());
            }
            File fileStorage = testSessionDao.getSessionStorage(session);
            testSessionDao.deleteTestSession(session);
            FileUtils.deleteDirsAndFiles(fileStorage, true, true);
        }
    }
    for (AssessmentEntry assessmentEntry : entries) {
        assessmentEntryDao.resetAssessmentEntry(assessmentEntry);
    }
    return true;
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) InMemoryAssessmentTestSession(org.olat.ims.qti21.model.InMemoryAssessmentTestSession) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File) HashSet(java.util.HashSet)

Example 50 with AssessmentEntry

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

the class AssessmentItemSessionDAOTest method createAndGetItemSession.

@Test
public void createAndGetItemSession() {
    // prepare a test and a user
    RepositoryEntry testEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("response-session-1");
    AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, testEntry, "-", testEntry);
    dbInstance.commit();
    String itemIdentifier = UUID.randomUUID().toString();
    ParentPartItemRefs parentParts = new ParentPartItemRefs();
    String sectionIdentifier = UUID.randomUUID().toString();
    parentParts.setSectionIdentifier(sectionIdentifier);
    String testPartIdentifier = UUID.randomUUID().toString();
    parentParts.setTestPartIdentifier(testPartIdentifier);
    // make test, item and response
    AssessmentTestSession testSession = testSessionDao.createAndPersistTestSession(testEntry, testEntry, "_", assessmentEntry, assessedIdentity, null, true);
    Assert.assertNotNull(testSession);
    AssessmentItemSession itemSession = itemSessionDao.createAndPersistAssessmentItemSession(testSession, parentParts, itemIdentifier);
    Assert.assertNotNull(itemSession);
    dbInstance.commitAndCloseSession();
    AssessmentItemSession reloadedItemSession = itemSessionDao.getAssessmentItemSession(testSession, itemIdentifier);
    Assert.assertNotNull(reloadedItemSession);
    Assert.assertNotNull(reloadedItemSession.getCreationDate());
    Assert.assertNotNull(reloadedItemSession.getLastModified());
    Assert.assertEquals(itemIdentifier, reloadedItemSession.getAssessmentItemIdentifier());
    Assert.assertEquals(sectionIdentifier, reloadedItemSession.getSectionIdentifier());
    Assert.assertEquals(testPartIdentifier, reloadedItemSession.getTestPartIdentifier());
}
Also used : ParentPartItemRefs(org.olat.ims.qti21.model.ParentPartItemRefs) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Test(org.junit.Test)

Aggregations

AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)150 Identity (org.olat.core.id.Identity)88 RepositoryEntry (org.olat.repository.RepositoryEntry)70 Test (org.junit.Test)50 ICourse (org.olat.course.ICourse)38 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)32 File (java.io.File)26 Date (java.util.Date)26 HashMap (java.util.HashMap)22 BigDecimal (java.math.BigDecimal)20 ArrayList (java.util.ArrayList)20 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)20 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)16 CourseNode (org.olat.course.nodes.CourseNode)16 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)16 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)14 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)12 AssessmentManager (org.olat.course.assessment.AssessmentManager)12 BusinessGroup (org.olat.group.BusinessGroup)12 List (java.util.List)10