use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class PFManagerTest method provideParticipantContainer.
@Test
public void provideParticipantContainer() {
// prepare
Identity initialAuthor = JunitTestHelper.createAndPersistIdentityAsRndUser("check-15");
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 check3 = JunitTestHelper.createAndPersistIdentityAsRndUser("check-3");
repositoryEntryRelationDao.addRole(check3, entry, GroupRoles.participant.name());
VFSContainer vfsContainer = pfManager.provideCoachOrParticipantContainer(pfNode, userCourseEnv, check3, false);
Assert.assertNotNull(vfsContainer);
Assert.assertTrue(vfsContainer.exists());
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class GTAAbstractController method doUpdateAttempts.
protected void doUpdateAttempts() {
Role by = getDoer();
if (businessGroupTask) {
List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
ICourse course = CourseFactory.loadCourse(courseEnv.getCourseGroupManager().getCourseEntry());
for (Identity identity : identities) {
UserCourseEnvironment uce = AssessmentHelper.createAndInitUserCourseEnvironment(identity, course);
gtaNode.incrementUserAttempts(uce, by);
}
} else {
UserCourseEnvironment assessedUserCourseEnv = getAssessedUserCourseEnvironment();
gtaNode.incrementUserAttempts(assessedUserCourseEnv, by);
}
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class GTANotifications method createAssessmentItem.
private void createAssessmentItem(Task task, Identity assessedIdentity, boolean coach) {
if (task == null || task.getGraduationDate() == null)
return;
if (task.getGraduationDate().after(compareDate)) {
RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
AssessmentEntry assessment = courseNodeAssessmentDao.loadAssessmentEntry(assessedIdentity, courseEntry, gtaNode.getIdent());
boolean resultsVisible = assessment != null && (assessment.getUserVisibility() == null || assessment.getUserVisibility().booleanValue());
if (resultsVisible) {
String score = null;
String status = null;
if (gtaNode.hasScoreConfigured() && assessment.getScore() != null) {
score = AssessmentHelper.getRoundedScore(assessment.getScore());
}
if (gtaNode.hasPassedConfigured() && assessment.getPassed() != null) {
status = assessment.getPassed().booleanValue() ? translator.translate("notifications.assessment.passed.true") : translator.translate("notifications.assessment.passed.false");
}
Date graduationDate = task.getGraduationDate();
String[] params = new String[] { getTaskName(task), courseEntry.getDisplayname(), score, status };
if (score != null && status != null) {
if (assessment.getPassed().booleanValue()) {
appendSubscriptionItem("notifications.assessment.score.passed", params, assessedIdentity, graduationDate, coach);
} else {
appendSubscriptionItem("notifications.assessment.score.notpassed", params, assessedIdentity, graduationDate, coach);
}
} else if (score != null) {
appendSubscriptionItem("notifications.assessment.score", params, assessedIdentity, graduationDate, coach);
} else if (status != null) {
appendSubscriptionItem("notifications.assessment.passed", params, assessedIdentity, graduationDate, coach);
}
ICourse course = CourseFactory.loadCourse(courseEnv.getCourseGroupManager().getCourseEntry());
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
List<File> docs = gtaNode.getIndividualAssessmentDocuments(assessedUserCourseEnv);
for (File doc : docs) {
String[] docParams = new String[] { getTaskName(task), courseEntry.getDisplayname(), doc.getName() };
appendSubscriptionItemForFile("notifications.assessment.doc", docParams, assessedIdentity, "[assessment:0]", doc, graduationDate, coach);
}
}
}
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class GTANotifications method doUpdateAttempts.
private void doUpdateAttempts(Identity assessedIdentity, BusinessGroup assessedGroup) {
ICourse course = CourseFactory.loadCourse(courseEnv.getCourseGroupManager().getCourseEntry());
if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
for (Identity identity : identities) {
UserCourseEnvironment uce = AssessmentHelper.createAndInitUserCourseEnvironment(identity, course);
gtaNode.incrementUserAttempts(uce, Role.auto);
}
} else {
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
gtaNode.incrementUserAttempts(assessedUserCourseEnv, Role.auto);
}
}
Aggregations