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);
}
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);
}
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();
}
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);
}
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);
}
Aggregations