Search in sources :

Example 36 with AssessmentEntry

use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentDetailsController method doUpdateEntry.

private void doUpdateEntry(AssessmentTestSession session) {
    AssessmentEntry assessmentEntry = assessmentService.loadAssessmentEntry(assessedIdentity, entry, null, entry);
    assessmentEntry.setScore(session.getFinalScore());
    assessmentEntry.setAssessmentId(session.getKey());
    assessmentService.updateAssessmentEntry(assessmentEntry);
}
Also used : AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 37 with AssessmentEntry

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

the class QTI21ResultsExportMediaResource method createAssessedMembersDetail.

private List<AssessedMember> createAssessedMembersDetail(ZipOutputStream zout) throws IOException {
    AssessmentManager assessmentManager = courseEnv.getAssessmentManager();
    List<AssessmentEntry> assessmentEntries = assessmentManager.getAssessmentEntries(courseNode);
    Map<Identity, AssessmentEntry> assessmentEntryMap = new HashMap<>();
    for (AssessmentEntry assessmentEntry : assessmentEntries) {
        assessmentEntryMap.put(assessmentEntry.getIdentity(), assessmentEntry);
    }
    List<AssessedMember> assessedMembers = new ArrayList<>();
    for (Identity identity : identities) {
        String idDir = exportFolderName + "/" + DATA + identity.getName();
        idDir = idDir.endsWith(SEP) ? idDir : idDir + SEP;
        createZipDirectory(zout, idDir);
        // content of single assessed member
        List<ResultDetail> assessments = createResultDetail(identity, zout, idDir);
        List<File> assessmentDocuments = assessmentManager.getIndividualAssessmentDocuments(courseNode, identity);
        Boolean passed = null;
        BigDecimal score = null;
        if (assessmentEntryMap.containsKey(identity)) {
            AssessmentEntry assessmentEntry = assessmentEntryMap.get(identity);
            passed = assessmentEntry.getPassed();
            score = assessmentEntry.getScore();
        }
        String linkToUser = idDir.replace(exportFolderName + "/", "") + "index.html";
        String memberEmail = userManager.getUserDisplayEmail(identity, ureq.getLocale());
        AssessedMember member = new AssessedMember(identity.getName(), identity.getUser().getLastName(), identity.getUser().getFirstName(), memberEmail, assessments.size(), passed, score, linkToUser);
        String userDataDir = exportFolderName + "/" + DATA + identity.getName();
        String singleUserInfoHTML = createResultListingHTML(assessments, assessmentDocuments, member);
        convertToZipEntry(zout, userDataDir + "/index.html", singleUserInfoHTML);
        assessedMembers.add(member);
        // assessment documents
        for (File document : assessmentDocuments) {
            String assessmentDocDir = userDataDir + "/Assessment_documents/" + document.getName();
            ZipUtil.addFileToZip(assessmentDocDir, document, zout);
        }
    }
    return assessedMembers;
}
Also used : HashMap(java.util.HashMap) AssessmentManager(org.olat.course.assessment.AssessmentManager) ArrayList(java.util.ArrayList) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) BigDecimal(java.math.BigDecimal) Identity(org.olat.core.id.Identity) TransientIdentity(org.olat.admin.user.imp.TransientIdentity) File(java.io.File)

Example 38 with AssessmentEntry

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

the class BinderPickerController method updateAssessmentInfos.

private void updateAssessmentInfos(Date returnDate) {
    if (returnDate != null) {
        String rDate = formatter.formatDateAndTime(returnDate);
        uifactory.addStaticTextElement("map.returnDate", rDate, infosContainer);
        AssessmentEntry assessmentEntry = assessmentService.loadAssessmentEntry(getIdentity(), templateEntry, null, templateEntry);
        assessmentInfosContainer.contextPut("hasScoreField", Boolean.FALSE);
        /* score
			if(courseNode.hasScoreConfigured()) {
				Float score = scoreEval.getScore();
				Float minScore = courseNode.getMinScoreConfiguration();
				Float maxScore = courseNode.getMaxScoreConfiguration();
				assessmentInfosContainer.contextPut("scoreMin", AssessmentHelper.getRoundedScore(minScore));
				assessmentInfosContainer.contextPut("scoreMax", AssessmentHelper.getRoundedScore(maxScore));
				assessmentInfosContainer.contextPut("score", AssessmentHelper.getRoundedScore(score));
			}
			*/
        // passed
        assessmentInfosContainer.contextPut("hasPassedField", Boolean.TRUE);
        // if(courseNode.hasPassedConfigured()) {
        Boolean passed = assessmentEntry.getPassed();
        assessmentInfosContainer.contextPut("passed", passed);
        assessmentInfosContainer.contextPut("hasPassedValue", new Boolean(passed != null));
        // Float cutValue = courseNode.getCutValueConfiguration();
        // assessmentInfosContainer.contextPut("passedCutValue", AssessmentHelper.getRoundedScore(cutValue));
        // }
        // get comment
        String comment = assessmentEntry.getComment();
        assessmentInfosContainer.contextPut("hasCommentField", new Boolean(comment != null));
        if (comment != null) {
            assessmentInfosContainer.contextPut("comment", comment);
        }
        assessmentInfosContainer.setVisible(true);
    } else {
        assessmentInfosContainer.setVisible(false);
    }
}
Also used : AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 39 with AssessmentEntry

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

the class PortfolioServiceImpl method setAssessmentStatus.

@Override
public void setAssessmentStatus(Identity assessedIdentity, BinderRef binderRef, AssessmentEntryStatus status, Identity coachingIdentity) {
    Boolean fullyAssessed = Boolean.FALSE;
    if (status == AssessmentEntryStatus.done) {
        fullyAssessed = Boolean.TRUE;
    }
    Binder binder = binderDao.loadByKey(binderRef.getKey());
    RepositoryEntry entry = binder.getEntry();
    if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(entry);
        CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
        if (courseNode instanceof PortfolioCourseNode) {
            PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
            ScoreEvaluation scoreEval = new ScoreEvaluation(eval.getScore(), eval.getPassed(), status, true, fullyAssessed, null, null, binder.getKey());
            pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
        }
    } else {
        OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
        RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
        AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
        assessmentEntry.setFullyAssessed(fullyAssessed);
        assessmentEntry.setAssessmentStatus(status);
        assessmentService.updateAssessmentEntry(assessmentEntry);
    }
}
Also used : Binder(org.olat.modules.portfolio.Binder) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 40 with AssessmentEntry

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

the class AssessmentEntryDAOTest method deleteEntryForRepositoryEntry.

@Test
public void deleteEntryForRepositoryEntry() {
    Identity assessedIdentity1 = JunitTestHelper.createAndPersistIdentityAsRndUser("as-node-20");
    Identity assessedIdentity2 = JunitTestHelper.createAndPersistIdentityAsRndUser("as-node-21");
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    RepositoryEntry refEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    String subIdent = UUID.randomUUID().toString();
    AssessmentEntry nodeAssessment1 = assessmentEntryDao.createAssessmentEntry(assessedIdentity1, null, entry, subIdent, refEntry);
    AssessmentEntry nodeAssessment2 = assessmentEntryDao.createAssessmentEntry(assessedIdentity2, null, entry, subIdent, refEntry, 3.0f, Boolean.FALSE, null, null);
    AssessmentEntry nodeAssessment3 = assessmentEntryDao.createAssessmentEntry(assessedIdentity2, null, entry, null, entry, 3.0f, Boolean.FALSE, null, null);
    AssessmentEntry nodeAssessment4 = assessmentEntryDao.createAssessmentEntry(assessedIdentity1, null, refEntry, subIdent, refEntry, 3.0f, Boolean.FALSE, null, null);
    dbInstance.commitAndCloseSession();
    // delete by reference
    assessmentEntryDao.deleteEntryForRepositoryEntry(entry);
    dbInstance.commitAndCloseSession();
    // check
    AssessmentEntry deletedAssessmentEntry1 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment1.getKey());
    Assert.assertNull(deletedAssessmentEntry1);
    AssessmentEntry deletedAssessmentEntry2 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment2.getKey());
    Assert.assertNull(deletedAssessmentEntry2);
    AssessmentEntry deletedAssessmentEntry3 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment3.getKey());
    Assert.assertNull(deletedAssessmentEntry3);
    AssessmentEntry deletedAssessmentEntry4 = assessmentEntryDao.loadAssessmentEntryById(nodeAssessment4.getKey());
    Assert.assertNotNull(deletedAssessmentEntry4);
}
Also used : 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