Search in sources :

Example 51 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class GTACoachRevisionAndCorrectionsController method doCollect.

private void doCollect() {
    assignedTask = gtaManager.updateTask(assignedTask, TaskProcess.correction, gtaNode, Role.coach);
    gtaManager.log("Collect revision", "revision collected", assignedTask, getIdentity(), assessedIdentity, assessedGroup, courseEnv, gtaNode);
    ICourse course = CourseFactory.loadCourse(courseEnv.getCourseResourceableId());
    if (businessGroupTask) {
        List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
        for (Identity identity : identities) {
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(identity, course);
            gtaNode.incrementUserAttempts(userCourseEnv, Role.coach);
        }
    } else {
        gtaNode.incrementUserAttempts(assessedUserCourseEnv, Role.coach);
    }
    TaskMultiUserEvent event = new TaskMultiUserEvent(TaskMultiUserEvent.SUBMIT_REVISION, assessedGroup == null ? getIdentity() : null, assessedGroup, getIdentity());
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, taskListEventResource);
}
Also used : UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) TaskMultiUserEvent(org.olat.course.nodes.gta.ui.events.TaskMultiUserEvent) ICourse(org.olat.course.ICourse) Identity(org.olat.core.id.Identity)

Example 52 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class EditCommentController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String comment = commentEl.getValue();
    row.setComment(comment);
    ICourse course = CourseFactory.loadCourse(courseOres);
    UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
    gtaNode.updateUserUserComment(comment, userCourseEnv, getIdentity());
    if (StringHelper.containsNonWhitespace(comment)) {
        row.getCommentEditLink().setIconLeftCSS("o_icon o_icon_comments");
    } else {
        row.getCommentEditLink().setIconLeftCSS("o_icon o_icon_comments_none");
    }
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse)

Example 53 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class QTI12PullTestsToolController method retrieveTest.

private void retrieveTest(Identity assessedIdentity, ICourse course) {
    ModuleConfiguration modConfig = courseNode.getModuleConfiguration();
    String resourcePathInfo = courseEnv.getCourseResourceableId() + File.separator + courseNode.getIdent();
    AssessmentInstance ai = AssessmentFactory.createAssessmentInstance(assessedIdentity, "", modConfig, false, courseEnv.getCourseResourceableId(), courseNode.getIdent(), resourcePathInfo, null);
    // close the test
    ai.stop();
    // persist the results
    iqm.persistResults(ai);
    // reporting
    Document docResReporting = iqm.getResultsReporting(ai, assessedIdentity, I18nModule.getDefaultLocale());
    FilePersister.createResultsReporting(docResReporting, assessedIdentity, ai.getFormattedType(), ai.getAssessID());
    // olat results
    AssessmentContext ac = ai.getAssessmentContext();
    Float score = new Float(ac.getScore());
    Boolean passed = new Boolean(ac.isPassed());
    ScoreEvaluation sceval = new ScoreEvaluation(score, passed, Boolean.FALSE, new Long(ai.getAssessID()));
    UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
    courseNode.updateUserScoreEvaluation(sceval, userCourseEnv, assessedIdentity, true, Role.coach);
    // cleanup
    ai.cleanUp();
}
Also used : AssessmentContext(org.olat.ims.qti.container.AssessmentContext) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentInstance(org.olat.ims.qti.process.AssessmentInstance) Document(org.dom4j.Document)

Example 54 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class PFManagerTest method provideCoachContainer.

@Test
public void provideCoachContainer() {
    // prepare
    Identity initialAuthor = JunitTestHelper.createAndPersistIdentityAsRndUser("check-16");
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(initialAuthor);
    PFCourseNode pfNode = new PFCourseNode();
    pfNode.getModuleConfiguration().setBooleanEntry(PFCourseNode.CONFIG_KEY_COACHBOX, true);
    pfNode.getModuleConfiguration().setBooleanEntry(PFCourseNode.CONFIG_KEY_PARTICIPANTBOX, true);
    // import "Demo course" into the bcroot_junittest
    RepositoryEntry entry = JunitTestHelper.deployDemoCourse(initialAuthor);
    Long resourceableId = entry.getOlatResource().getResourceableId();
    ICourse course = CourseFactory.loadCourse(resourceableId);
    UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
    Identity check4 = JunitTestHelper.createAndPersistIdentityAsRndUser("check-4");
    repositoryEntryRelationDao.addRole(check4, entry, GroupRoles.coach.name());
    VFSContainer vfsContainer = pfManager.provideCoachOrParticipantContainer(pfNode, userCourseEnv, check4, false);
    Assert.assertNotNull(vfsContainer);
}
Also used : PFCourseNode(org.olat.course.nodes.PFCourseNode) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) VFSContainer(org.olat.core.util.vfs.VFSContainer) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment) Test(org.junit.Test)

Example 55 with UserCourseEnvironment

use of org.olat.course.run.userview.UserCourseEnvironment in project openolat by klemens.

the class ConditionTest method testTrueFalse.

@Test
public void testTrueFalse() {
    UserCourseEnvironment uce = getUserDemoCourseEnvironment();
    ConditionInterpreter interpreter = new ConditionInterpreter(uce);
    String condition = "true";
    boolean result = interpreter.evaluateCondition(condition);
    Assert.assertTrue(result);
    condition = "TRUE";
    result = interpreter.evaluateCondition(condition);
    Assert.assertFalse(result);
    condition = "false";
    result = interpreter.evaluateCondition(condition);
    Assert.assertFalse(result);
    condition = "FALSE";
    result = interpreter.evaluateCondition(condition);
    Assert.assertFalse(result);
}
Also used : ConditionInterpreter(org.olat.course.condition.interpreter.ConditionInterpreter) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) Test(org.junit.Test)

Aggregations

UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)158 ICourse (org.olat.course.ICourse)84 Identity (org.olat.core.id.Identity)60 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)58 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)54 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)52 CourseNode (org.olat.course.nodes.CourseNode)42 RepositoryEntry (org.olat.repository.RepositoryEntry)42 Test (org.junit.Test)28 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)24 ConditionInterpreter (org.olat.course.condition.interpreter.ConditionInterpreter)20 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)16 Roles (org.olat.core.id.Roles)14 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)14 ArrayList (java.util.ArrayList)12 VFSContainer (org.olat.core.util.vfs.VFSContainer)12 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)12 OLATResource (org.olat.resource.OLATResource)12 Date (java.util.Date)10 AssessmentManager (org.olat.course.assessment.AssessmentManager)10