Search in sources :

Example 26 with AssessmentEntry

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

the class AssessedIdentityListController method updateModel.

protected void updateModel(String searchString, List<FlexiTableFilter> filters, List<FlexiTableFilter> extendedFilters) {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(testEntry, null, testEntry, assessmentCallback);
    List<AssessmentEntryStatus> assessmentStatus = null;
    if (filters != null && filters.size() > 0) {
        assessmentStatus = new ArrayList<>(filters.size());
        for (FlexiTableFilter filter : filters) {
            if ("passed".equals(filter.getFilter())) {
                params.setPassed(true);
            } else if ("failed".equals(filter.getFilter())) {
                params.setFailed(true);
            } else if (AssessmentEntryStatus.isValueOf(filter.getFilter())) {
                assessmentStatus.add(AssessmentEntryStatus.valueOf(filter.getFilter()));
            }
        }
    }
    params.setAssessmentStatus(assessmentStatus);
    List<Long> businessGroupKeys = null;
    if (extendedFilters != null && extendedFilters.size() > 0) {
        businessGroupKeys = new ArrayList<>(extendedFilters.size());
        for (FlexiTableFilter extendedFilter : extendedFilters) {
            if (StringHelper.isLong(extendedFilter.getFilter())) {
                businessGroupKeys.add(Long.parseLong(extendedFilter.getFilter()));
            }
        }
    }
    params.setBusinessGroupKeys(businessGroupKeys);
    params.setSearchString(searchString);
    List<Identity> assessedIdentities = assessmentToolManager.getAssessedIdentities(getIdentity(), params);
    List<AssessmentEntry> assessmentEntries = assessmentToolManager.getAssessmentEntries(getIdentity(), params, null);
    Map<Long, AssessmentEntry> entryMap = new HashMap<>();
    assessmentEntries.stream().filter((entry) -> entry.getIdentity() != null).forEach((entry) -> entryMap.put(entry.getIdentity().getKey(), entry));
    Map<Long, Date> initialLaunchDates = userInfosMgr.getInitialLaunchDates(testEntry.getOlatResource());
    List<AssessedIdentityElementRow> rows = new ArrayList<>(assessedIdentities.size());
    for (Identity assessedIdentity : assessedIdentities) {
        AssessmentEntry entry = entryMap.get(assessedIdentity.getKey());
        AssessedIdentityElementRow row = new AssessedIdentityElementRow(assessedIdentity, entry, null, null, userPropertyHandlers, getLocale());
        row.setInitialCourseLaunchDate(initialLaunchDates.get(assessedIdentity.getKey()));
        rows.add(row);
    }
    usersTableModel.setObjects(rows);
    if (filters != null && filters.size() > 0 && filters.get(0) != null) {
        usersTableModel.filter(Collections.singletonList(filters.get(0)));
    }
    tableEl.reloadData();
    searchParams = params;
    updateTools(assessedIdentities);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Util(org.olat.core.util.Util) RepositoryHandlerFactory(org.olat.repository.handlers.RepositoryHandlerFactory) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssessmentToolManager(org.olat.course.assessment.AssessmentToolManager) Date(java.util.Date) UserCourseInformationsManager(org.olat.course.assessment.manager.UserCourseInformationsManager) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) RepositoyUIFactory(org.olat.repository.ui.RepositoyUIFactory) AssessmentToolOptions(org.olat.modules.assessment.AssessmentToolOptions) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) Map(java.util.Map) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) AssessmentModule(org.olat.course.assessment.AssessmentModule) WindowControl(org.olat.core.gui.control.WindowControl) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) IdentityCourseElementCols(org.olat.modules.assessment.ui.AssessedIdentityListTableModel.IdentityCourseElementCols) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) List(java.util.List) Align(org.olat.core.gui.components.stack.TooledStackedPanel.Align) Identity(org.olat.core.id.Identity) BaseSecurity(org.olat.basesecurity.BaseSecurity) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) HashMap(java.util.HashMap) RepositoryEntry(org.olat.repository.RepositoryEntry) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) BusinessGroupService(org.olat.group.BusinessGroupService) Link(org.olat.core.gui.components.link.Link) AssessmentStatusCellRenderer(org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams) Controller(org.olat.core.gui.control.Controller) UserManager(org.olat.user.UserManager) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessmentToolConstants(org.olat.course.assessment.ui.tool.AssessmentToolConstants) AssessedIdentityListProvider(org.olat.course.assessment.ui.tool.AssessedIdentityListProvider) BusinessGroup(org.olat.group.BusinessGroup) UserRequest(org.olat.core.gui.UserRequest) Collections(java.util.Collections) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) Identity(org.olat.core.id.Identity)

Example 27 with AssessmentEntry

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

the class AssessmentToReviewSmallController method loadModel.

private void loadModel() {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(testEntry, null, testEntry, assessmentCallback);
    List<AssessmentEntry> entries = assessmentToolManager.getAssessmentEntries(getIdentity(), params, AssessmentEntryStatus.inReview);
    List<UserToReviewRow> rows = new ArrayList<>();
    Map<Long, UserToReviewRow> identityKeyToRow = new HashMap<>();
    for (AssessmentEntry entry : entries) {
        Identity assessedIdentity = entry.getIdentity();
        if (identityKeyToRow.containsKey(assessedIdentity.getKey())) {
            identityKeyToRow.get(assessedIdentity.getKey()).getSubIndents().add(entry.getSubIdent());
        } else {
            UserToReviewRow row = new UserToReviewRow(entry.getIdentity(), userPropertyHandlers, getLocale());
            row.getSubIndents().add(entry.getSubIdent());
            rows.add(row);
            identityKeyToRow.put(assessedIdentity.getKey(), row);
        }
    }
    usersTableModel.setObjects(rows);
    tableEl.reset();
}
Also used : HashMap(java.util.HashMap) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 28 with AssessmentEntry

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

the class CheckListRunController method exposeUserDataToVC.

private void exposeUserDataToVC(UserRequest ureq, FormLayoutContainer layoutCont) {
    AssessmentEntry scoreEval = courseNode.getUserAssessmentEntry(userCourseEnv);
    if (scoreEval == null) {
        layoutCont.contextPut("score", null);
        layoutCont.contextPut("hasPassedValue", Boolean.FALSE);
        layoutCont.contextPut("passed", null);
        layoutCont.contextPut("comment", null);
        layoutCont.contextPut("docs", null);
    } else {
        boolean resultsVisible = scoreEval.getUserVisibility() == null || scoreEval.getUserVisibility().booleanValue();
        layoutCont.contextPut("resultsVisible", resultsVisible);
        layoutCont.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
        layoutCont.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        layoutCont.contextPut("passed", scoreEval.getPassed());
        if (resultsVisible) {
            if (courseNode.hasCommentConfigured()) {
                StringBuilder comment = Formatter.stripTabsAndReturns(scoreEval.getComment());
                layoutCont.contextPut("comment", StringHelper.xssScan(comment));
                layoutCont.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
            }
            if (courseNode.hasIndividualAsssessmentDocuments()) {
                List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
                String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                layoutCont.contextPut("docsMapperUri", mapperUri);
                layoutCont.contextPut("docs", docs);
                layoutCont.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
            }
        } else {
            layoutCont.contextPut("comment", null);
            layoutCont.contextPut("docs", null);
        }
    }
    UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    layoutCont.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 29 with AssessmentEntry

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

the class GroupAssessmentController method loadModel.

/**
 * @return True if all results are the same
 */
private ModelInfos loadModel() {
    // load participants, load datas
    ICourse course = CourseFactory.loadCourse(courseEntry);
    List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
    Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
    List<AssessmentEntry> entries = course.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(assessedGroup, gtaNode);
    for (AssessmentEntry entry : entries) {
        identityToEntryMap.put(entry.getIdentity(), entry);
    }
    int count = 0;
    boolean same = true;
    StringBuilder duplicateWarning = new StringBuilder();
    Float scoreRef = null;
    Boolean passedRef = null;
    String commentRef = null;
    Boolean userVisibleRef = null;
    List<AssessmentRow> rows = new ArrayList<>(identities.size());
    for (Identity identity : identities) {
        AssessmentEntry entry = identityToEntryMap.get(identity);
        ScoreEvaluation scoreEval = null;
        if (withScore || withPassed) {
            scoreEval = gtaNode.getUserScoreEvaluation(entry);
            if (scoreEval == null) {
                scoreEval = ScoreEvaluation.EMPTY_EVALUATION;
            }
        }
        String comment = null;
        if (withComment && entry != null) {
            comment = entry.getComment();
        }
        boolean duplicate = duplicateMemberKeys.contains(identity.getKey());
        if (duplicate) {
            if (duplicateWarning.length() > 0)
                duplicateWarning.append(", ");
            duplicateWarning.append(StringHelper.escapeHtml(userManager.getUserDisplayName(identity)));
        }
        AssessmentRow row = new AssessmentRow(identity, duplicate);
        rows.add(row);
        if (withScore) {
            Float score = scoreEval.getScore();
            String pointVal = AssessmentHelper.getRoundedScore(score);
            TextElement pointEl = uifactory.addTextElement("point" + count, null, 5, pointVal, flc);
            pointEl.setDisplaySize(5);
            row.setScoreEl(pointEl);
            if (count == 0) {
                scoreRef = score;
            } else if (!same(scoreRef, score)) {
                same = false;
            }
        }
        if (withPassed && cutValue == null) {
            Boolean passed = scoreEval.getPassed();
            MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + count, null, flc, onKeys, onValues);
            if (passed != null && passed.booleanValue()) {
                passedEl.select(onKeys[0], passed.booleanValue());
            }
            row.setPassedEl(passedEl);
            if (count == 0) {
                passedRef = passed;
            } else if (!same(passedRef, passed)) {
                same = false;
            }
        }
        if (withComment) {
            FormLink commentLink = uifactory.addFormLink("comment-" + CodeHelper.getRAMUniqueID(), "comment", "comment", null, flc, Link.LINK);
            if (StringHelper.containsNonWhitespace(comment)) {
                commentLink.setIconLeftCSS("o_icon o_icon_comments");
            } else {
                commentLink.setIconLeftCSS("o_icon o_icon_comments_none");
            }
            commentLink.setUserObject(row);
            row.setComment(comment);
            row.setCommentEditLink(commentLink);
            if (count == 0) {
                commentRef = comment;
            } else if (!same(commentRef, comment)) {
                same = false;
            }
        }
        if (withScore || withPassed || withPassed) {
            Boolean userVisible = scoreEval.getUserVisible();
            if (userVisible == null) {
                userVisible = Boolean.TRUE;
            }
            if (count == 0) {
                userVisibleRef = userVisible;
            } else if (!same(userVisibleRef, userVisible)) {
                same = false;
            }
        }
        count++;
    }
    model.setObjects(rows);
    table.reset();
    return new ModelInfos(same, scoreRef, passedRef, commentRef, userVisibleRef, duplicateWarning.toString());
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Identity(org.olat.core.id.Identity)

Example 30 with AssessmentEntry

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

the class MSCourseNodeRunController method exposeUserDataToVC.

private void exposeUserDataToVC(UserRequest ureq) {
    AssessmentEntry assessmentEntry = courseNode.getUserAssessmentEntry(userCourseEnv);
    if (assessmentEntry == null) {
        myContent.contextPut("hasPassedValue", Boolean.FALSE);
        myContent.contextPut("passed", Boolean.FALSE);
        hasPassed = hasScore = hasComment = false;
    } else {
        String rawComment = assessmentEntry.getComment();
        hasPassed = assessmentEntry.getPassed() != null;
        hasScore = assessmentEntry.getScore() != null;
        hasComment = courseNode.hasCommentConfigured() && StringHelper.containsNonWhitespace(rawComment);
        boolean resultsVisible = overrideUserResultsVisiblity || assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
        myContent.contextPut("resultsVisible", resultsVisible);
        myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
        myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        myContent.contextPut("passed", assessmentEntry.getPassed());
        if (resultsVisible) {
            if (hasComment) {
                StringBuilder comment = Formatter.stripTabsAndReturns(rawComment);
                myContent.contextPut("comment", StringHelper.xssScan(comment));
                myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
            }
            if (courseNode.hasIndividualAsssessmentDocuments()) {
                List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
                mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                myContent.contextPut("docsMapperUri", mapperUri);
                myContent.contextPut("docs", docs);
                myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
                if (download == null) {
                    download = new DisplayOrDownloadComponent("", null);
                    myContent.put("download", download);
                }
            }
        }
    }
    if (showLog) {
        UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
        myContent.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
    }
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) DisplayOrDownloadComponent(org.olat.core.gui.components.download.DisplayOrDownloadComponent) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

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