Search in sources :

Example 26 with IQTESTCourseNode

use of org.olat.course.nodes.IQTESTCourseNode in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_11_0_0 method createAssessmentEntry.

private AssessmentEntryImpl createAssessmentEntry(Identity assessedIdentity, Property property, ICourse course, RepositoryEntry courseEntry, String nodeIdent) {
    AssessmentEntryImpl entry = new AssessmentEntryImpl();
    if (property == null) {
        entry.setCreationDate(new Date());
        entry.setLastModified(entry.getCreationDate());
    } else {
        entry.setCreationDate(property.getCreationDate());
        entry.setLastModified(property.getLastModified());
    }
    entry.setIdentity(assessedIdentity);
    entry.setRepositoryEntry(courseEntry);
    entry.setSubIdent(nodeIdent);
    entry.setAttempts(new Integer(0));
    entry.setUserVisibility(Boolean.TRUE);
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
    if (courseNode != null) {
        if (courseNode.needsReferenceToARepositoryEntry()) {
            RepositoryEntry referenceEntry = courseNode.getReferencedRepositoryEntry();
            entry.setReferenceEntry(referenceEntry);
        }
        if (courseNode instanceof GTACourseNode) {
            processAssessmentPropertyForGTA(assessedIdentity, entry, (GTACourseNode) courseNode, courseEntry);
        } else if (courseNode instanceof TACourseNode) {
            processAssessmentPropertyForTA(assessedIdentity, entry, (TACourseNode) courseNode, course);
        } else if (courseNode instanceof IQTESTCourseNode) {
            processAssessmentPropertyForIQTEST(assessedIdentity, entry, (IQTESTCourseNode) courseNode, course);
        } else if (courseNode instanceof PortfolioCourseNode) {
            processAssessmentPropertyForPortfolio(assessedIdentity, entry, (PortfolioCourseNode) courseNode, course);
        } else if (courseNode instanceof MSCourseNode) {
            entry.setAssessmentStatus(AssessmentEntryStatus.inReview);
        } else if (courseNode instanceof BasicLTICourseNode) {
            processAssessmentPropertyForBasicLTI(assessedIdentity, entry, (BasicLTICourseNode) courseNode, course);
        } else if (courseNode instanceof ScormCourseNode) {
            String username = assessedIdentity.getName();
            Map<Date, List<CmiData>> rawDatas = ScormAssessmentManager.getInstance().visitScoDatasMultiResults(username, course.getCourseEnvironment(), (ScormCourseNode) courseNode);
            if (rawDatas != null && rawDatas.size() > 0) {
                entry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
            } else {
                entry.setAssessmentStatus(AssessmentEntryStatus.notStarted);
            }
        }
    }
    return entry;
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) GTACourseNode(org.olat.course.nodes.GTACourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) Date(java.util.Date) AssessmentEntryImpl(org.olat.modules.assessment.model.AssessmentEntryImpl) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) ArrayList(java.util.ArrayList) List(java.util.List) STCourseNode(org.olat.course.nodes.STCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode)

Example 27 with IQTESTCourseNode

use of org.olat.course.nodes.IQTESTCourseNode in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_11_0_0 method postCopyPassedScore.

/**
 * Used if a passed or score value was set.
 * @param nodeAssessment
 * @param course
 */
private void postCopyPassedScore(AssessmentEntry entry, ICourse course) {
    String nodeIdent = entry.getSubIdent();
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
    if (courseNode instanceof GTACourseNode) {
    // 
    } else if (courseNode instanceof TACourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof IQTESTCourseNode) {
    // 
    } else if (courseNode instanceof PortfolioCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof MSCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof BasicLTICourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof ScormCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    }
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode)

Example 28 with IQTESTCourseNode

use of org.olat.course.nodes.IQTESTCourseNode in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method updateOutcomes.

@Override
public void updateOutcomes(Float score, Boolean pass, Double completion) {
    if (courseNode instanceof IQTESTCourseNode) {
        ((IQTESTCourseNode) courseNode).updateCurrentCompletion(userCourseEnv, getIdentity(), completion, AssessmentRunStatus.running, Role.user);
        coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new CompletionEvent(CompletionEvent.PROGRESS, courseNode.getIdent(), completion, AssessmentRunStatus.running, getIdentity().getKey()), userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseResource());
    }
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) CompletionEvent(org.olat.modules.assessment.ui.event.CompletionEvent)

Example 29 with IQTESTCourseNode

use of org.olat.course.nodes.IQTESTCourseNode in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method submit.

@Override
public void submit(Float score, Boolean pass, Double completion, Long assessmentId) {
    if (anonym) {
        assessmentNotificationsHandler.markPublisherNews(getIdentity(), userCourseEnv.getCourseEnvironment().getCourseResourceableId());
        return;
    }
    if (courseNode instanceof IQTESTCourseNode) {
        Boolean visibility;
        AssessmentEntryStatus assessmentStatus;
        if (IQEditController.CORRECTION_MANUAL.equals(courseNode.getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE))) {
            assessmentStatus = AssessmentEntryStatus.inReview;
            visibility = Boolean.FALSE;
        } else {
            assessmentStatus = AssessmentEntryStatus.done;
            visibility = Boolean.TRUE;
        }
        ScoreEvaluation sceval = new ScoreEvaluation(score, pass, assessmentStatus, visibility, Boolean.TRUE, completion, AssessmentRunStatus.done, assessmentId);
        boolean increment = incrementAttempts.getAndSet(false);
        ((IQTESTCourseNode) courseNode).updateUserScoreEvaluation(sceval, userCourseEnv, getIdentity(), increment, Role.user);
        if (increment) {
            ThreadLocalUserActivityLogger.log(QTI21LoggingAction.QTI_CLOSE_IN_COURSE, getClass());
        }
        coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new CompletionEvent(CompletionEvent.PROGRESS, courseNode.getIdent(), completion, AssessmentRunStatus.done, getIdentity().getKey()), userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseResource());
        assessmentNotificationsHandler.markPublisherNews(getIdentity(), userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    } else if (courseNode instanceof SelfAssessableCourseNode) {
        boolean increment = incrementAttempts.getAndSet(false);
        if (increment) {
            ((SelfAssessableCourseNode) courseNode).incrementUserAttempts(userCourseEnv, Role.user);
        }
    }
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) CompletionEvent(org.olat.modules.assessment.ui.event.CompletionEvent) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Example 30 with IQTESTCourseNode

use of org.olat.course.nodes.IQTESTCourseNode in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method initAssessment.

private void initAssessment(UserRequest ureq) {
    // config : show score info
    boolean enableScoreInfo = config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    mainVC.contextPut("enableScoreInfo", Boolean.valueOf(enableScoreInfo));
    // configuration data
    int maxAttempts = deliveryOptions.getMaxAttempts();
    if (maxAttempts > 0) {
        mainVC.contextPut("attemptsConfig", Integer.valueOf(maxAttempts));
    } else {
        mainVC.contextPut("attemptsConfig", Boolean.FALSE);
    }
    // configure date period
    mainVC.contextPut("blockDate", Boolean.valueOf(blockedBasedOnDate()));
    // time limit
    Long timeLimit = getAssessmentTestMaxTimeLimit();
    if (timeLimit != null) {
        mainVC.contextPut("timeLimit", Formatter.formatHourAndSeconds(timeLimit.longValue() * 1000l));
    }
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        if (assessableCourseNode.hasScoreConfigured() || userCourseEnv.isCoach()) {
            HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode);
            if (highScoreCtr.isViewHighscore()) {
                Component highScoreComponent = highScoreCtr.getInitialComponent();
                mainVC.put("highScore", highScoreComponent);
            }
        }
    }
    // user data
    if (courseNode instanceof SelfAssessableCourseNode) {
        SelfAssessableCourseNode acn = (SelfAssessableCourseNode) courseNode;
        ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);
        Integer attempts = acn.getUserAttempts(userCourseEnv);
        if (scoreEval != null) {
            mainVC.contextPut("resultsVisible", Boolean.TRUE);
            mainVC.contextPut("hasResults", Boolean.TRUE);
            mainVC.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
            mainVC.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
            mainVC.contextPut("passed", scoreEval.getPassed());
            // at least one attempt
            mainVC.contextPut("attempts", attempts);
            mainVC.contextPut("showChangeLog", Boolean.TRUE && enableScoreInfo);
            exposeResults(ureq, true);
        } else {
            exposeResults(ureq, false);
        }
    } else if (courseNode instanceof IQTESTCourseNode) {
        IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
        AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
        if (assessmentEntry == null) {
            mainVC.contextPut("blockAfterSuccess", Boolean.FALSE);
            mainVC.contextPut("score", null);
            mainVC.contextPut("hasPassedValue", Boolean.FALSE);
            mainVC.contextPut("passed", Boolean.FALSE);
            mainVC.contextPut("comment", null);
            mainVC.contextPut("attempts", 0);
            mainVC.contextPut("showChangeLog", Boolean.FALSE);
        } else {
            Boolean passed = assessmentEntry.getPassed();
            // block if test passed (and config set to check it)
            Boolean blocked = Boolean.FALSE;
            boolean blockAfterSuccess = deliveryOptions.isBlockAfterSuccess();
            if (blockAfterSuccess && passed != null && passed.booleanValue()) {
                blocked = Boolean.TRUE;
            }
            mainVC.contextPut("blockAfterSuccess", blocked);
            boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
            mainVC.contextPut("resultsVisible", resultsVisible);
            mainVC.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
            mainVC.contextPut("hasPassedValue", (passed == null ? Boolean.FALSE : Boolean.TRUE));
            mainVC.contextPut("passed", passed);
            if (resultsVisible) {
                if (testCourseNode.hasCommentConfigured()) {
                    StringBuilder comment = Formatter.stripTabsAndReturns(testCourseNode.getUserUserComment(userCourseEnv));
                    if (comment != null && comment.length() > 0) {
                        mainVC.contextPut("comment", StringHelper.xssScan(comment));
                        mainVC.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
                    }
                }
                if (testCourseNode.hasIndividualAsssessmentDocuments()) {
                    List<File> docs = testCourseNode.getIndividualAssessmentDocuments(userCourseEnv);
                    String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                    mainVC.contextPut("docsMapperUri", mapperUri);
                    mainVC.contextPut("docs", docs);
                    mainVC.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
                }
            }
            Integer attempts = assessmentEntry.getAttempts();
            mainVC.contextPut("attempts", attempts == null ? new Integer(0) : attempts);
            boolean showChangelog = (!anonym && enableScoreInfo && resultsVisible && isResultVisible(config));
            mainVC.contextPut("showChangeLog", showChangelog);
            if (deliveryOptions.isDigitalSignature()) {
                AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
                if (session != null) {
                    File signature = qtiService.getAssessmentResultSignature(session);
                    if (signature != null && signature.exists()) {
                        signatureDownloadLink = LinkFactory.createLink("digital.signature.download.link", mainVC, this);
                        signatureDownloadLink.setIconLeftCSS("o_icon o_icon-fw o_icon_download");
                        signatureDownloadLink.setTarget("_blank");
                        Date issueDate = qtiService.getAssessmentResultSignatureIssueDate(session);
                        if (issueDate != null) {
                            mainVC.contextPut("signatureIssueDate", Formatter.getInstance(getLocale()).formatDateAndTime(issueDate));
                        }
                    }
                }
            }
            exposeResults(ureq, resultsVisible);
        }
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) List(java.util.List) Component(org.olat.core.gui.components.Component) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) File(java.io.File) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode)

Aggregations

IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)50 RepositoryEntry (org.olat.repository.RepositoryEntry)14 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)12 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)10 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 CourseNode (org.olat.course.nodes.CourseNode)10 File (java.io.File)8 Identity (org.olat.core.id.Identity)8 MSCourseNode (org.olat.course.nodes.MSCourseNode)8 ScormCourseNode (org.olat.course.nodes.ScormCourseNode)8 TACourseNode (org.olat.course.nodes.TACourseNode)8 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)8 ICourse (org.olat.course.ICourse)6 GTACourseNode (org.olat.course.nodes.GTACourseNode)6 STCourseNode (org.olat.course.nodes.STCourseNode)6 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)6 QTI21ResetDataController (org.olat.ims.qti21.ui.QTI21ResetDataController)6 QTI21RetrieveTestsController (org.olat.ims.qti21.ui.QTI21RetrieveTestsController)5 IOException (java.io.IOException)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4