Search in sources :

Example 91 with AssessmentEntry

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

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 92 with AssessmentEntry

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

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 93 with AssessmentEntry

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

the class PortfolioServiceImpl method updateAssessmentEntry.

private void updateAssessmentEntry(Identity assessedIdentity, Binder binder, Set<AssessmentSection> assessmentSections, Identity coachingIdentity) {
    boolean allPassed = true;
    int totalSectionPassed = 0;
    int totalSectionClosed = 0;
    BigDecimal totalScore = new BigDecimal("0.0");
    AssessmentEntryStatus binderStatus = null;
    for (AssessmentSection assessmentSection : assessmentSections) {
        if (assessmentSection.getScore() != null) {
            totalScore = totalScore.add(assessmentSection.getScore());
        }
        if (assessmentSection.getPassed() != null && assessmentSection.getPassed().booleanValue()) {
            allPassed &= true;
            totalSectionPassed++;
        }
        Section section = assessmentSection.getSection();
        if (section.getSectionStatus() == SectionStatus.closed) {
            totalSectionClosed++;
        }
    }
    Boolean totalPassed = null;
    if (totalSectionClosed == assessmentSections.size()) {
        totalPassed = new Boolean(allPassed);
    } else {
        if (assessmentSections.size() == totalSectionPassed) {
            totalPassed = Boolean.TRUE;
        }
        binderStatus = AssessmentEntryStatus.inProgress;
    }
    // order status from the entry / section
    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;
            ScoreEvaluation scoreEval = new ScoreEvaluation(totalScore.floatValue(), totalPassed, binderStatus, true, true, null, null, binder.getKey());
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            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.setScore(totalScore);
        assessmentEntry.setPassed(totalPassed);
        assessmentEntry.setAssessmentStatus(binderStatus);
        assessmentService.updateAssessmentEntry(assessmentEntry);
    }
}
Also used : PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) BigDecimal(java.math.BigDecimal) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 94 with AssessmentEntry

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

the class GTACoachedGroupGradingController method loadMembers.

private void loadMembers() {
    // load participants, load datas
    List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
    Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
    List<AssessmentEntry> assessmentEntries = assessmentManager.getAssessmentEntries(assessedGroup, gtaNode);
    for (AssessmentEntry entry : assessmentEntries) {
        identityToEntryMap.put(entry.getIdentity(), entry);
    }
    List<AssessmentRow> rows = new ArrayList<>(identities.size());
    for (Identity identity : identities) {
        AssessmentEntry entry = identityToEntryMap.get(identity);
        AssessmentRow row = new AssessmentRow(identity, false);
        rows.add(row);
        if (withScore && entry != null) {
            String pointVal = AssessmentHelper.getRoundedScore(entry.getScore());
            row.setScore(pointVal);
        }
        if (withPassed && entry != null) {
            row.setPassed(entry.getPassed());
        }
        if (withComment) {
            FormLink commentLink = null;
            String comment = null;
            if (entry != null && StringHelper.containsNonWhitespace(entry.getComment())) {
                comment = entry.getComment();
                commentLink = uifactory.addFormLink("comment-" + CodeHelper.getRAMUniqueID(), "comment", "comment", null, flc, Link.LINK);
                commentLink.setIconLeftCSS("o_icon o_icon_comments");
                commentLink.setUserObject(row);
            }
            row.setComment(comment);
            row.setCommentTooltipLink(commentLink);
        }
    }
    model.setObjects(rows);
    table.reset();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 95 with AssessmentEntry

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

the class GTACoachedParticipantListController method updateModel.

protected void updateModel(UserRequest ureq) {
    RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
    List<TaskLight> tasks = gtaManager.getTasksLight(entry, gtaNode);
    Map<Long, TaskLight> identityToTasks = new HashMap<>(tasks.size());
    for (TaskLight task : tasks) {
        if (task.getIdentityKey() != null) {
            identityToTasks.put(task.getIdentityKey(), task);
        }
    }
    List<IdentityMark> marks = gtaManager.getMarks(entry, gtaNode, ureq.getIdentity());
    Map<Long, IdentityMark> identityToMarks = new HashMap<>(marks.size());
    for (IdentityMark mark : marks) {
        if (mark.getParticipant() != null) {
            identityToMarks.put(mark.getParticipant().getKey(), mark);
        }
    }
    List<AssessmentEntry> assessments = assessmentService.loadAssessmentEntriesBySubIdent(entry, gtaNode.getIdent());
    Map<Long, AssessmentEntry> identityToAssessments = new HashMap<>(assessments.size());
    for (AssessmentEntry assessment : assessments) {
        if (assessment.getIdentity() != null) {
            identityToAssessments.put(assessment.getIdentity().getKey(), assessment);
        }
    }
    List<CoachedIdentityRow> rows = new ArrayList<>(assessableIdentities.size());
    for (UserPropertiesRow assessableIdentity : assessableIdentities) {
        IdentityMark mark = identityToMarks.get(assessableIdentity.getIdentityKey());
        if (markedOnly && mark == null)
            continue;
        FormLink markLink = uifactory.addFormLink("mark_" + assessableIdentity.getIdentityKey(), "mark", "", null, null, Link.NONTRANSLATED);
        markLink.setIconLeftCSS(mark != null ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        markLink.setUserObject(assessableIdentity.getIdentityKey());
        TaskLight task = identityToTasks.get(assessableIdentity.getIdentityKey());
        Date submissionDueDate = null;
        if (task == null || task.getTaskStatus() == null || task.getTaskStatus() == TaskProcess.assignment) {
            IdentityRef identityRef = new IdentityRefImpl(assessableIdentity.getIdentityKey());
            DueDate dueDate = gtaManager.getSubmissionDueDate(task, identityRef, null, gtaNode, entry, true);
            if (dueDate != null) {
                submissionDueDate = dueDate.getDueDate();
            }
        }
        Date syntheticSubmissionDate = null;
        boolean hasSubmittedDocument = false;
        if (task != null && task.getTaskStatus() != null && task.getTaskStatus() != TaskProcess.assignment && task.getTaskStatus() != TaskProcess.submit) {
            syntheticSubmissionDate = getSyntheticSubmissionDate(task);
            if (syntheticSubmissionDate != null) {
                hasSubmittedDocument = hasSubmittedDocument(task);
            }
        }
        int numSubmittedDocs = task != null && task.getSubmissionNumOfDocs() != null ? task.getSubmissionNumOfDocs() : 0;
        AssessmentEntry assessment = identityToAssessments.get(assessableIdentity.getIdentityKey());
        Boolean userVisibility = assessment != null ? assessment.getUserVisibility() : null;
        BigDecimal score = assessment != null ? assessment.getScore() : null;
        Boolean passed = assessment != null ? assessment.getPassed() : null;
        rows.add(new CoachedIdentityRow(assessableIdentity, task, submissionDueDate, syntheticSubmissionDate, hasSubmittedDocument, markLink, userVisibility, score, passed, numSubmittedDocs));
    }
    tableModel.setObjects(rows);
    tableEl.reset();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) TaskLight(org.olat.course.nodes.gta.TaskLight) UserPropertiesRow(org.olat.user.UserPropertiesRow) DueDate(org.olat.course.nodes.gta.model.DueDate) IdentityMark(org.olat.course.nodes.gta.IdentityMark) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) BigDecimal(java.math.BigDecimal)

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