use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method deleteTaskList_withRevisionDates.
@Test
public void deleteTaskList_withRevisionDates() {
Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-9");
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-10");
BusinessGroup businessGroup = businessGroupDao.createAndPersist(coach, "gdao", "gdao-desc", -1, -1, false, false, false, false, false);
businessGroupRelationDao.addRole(participant, businessGroup, GroupRole.participant.name());
dbInstance.commit();
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.group.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
File taskFile = new File("bg.txt");
Assert.assertNotNull(tasks);
dbInstance.commit();
// select
AssignmentResponse response = gtaManager.selectTask(businessGroup, tasks, node, taskFile);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(response);
// check that there is tasks
List<Task> assignedTasks = gtaManager.getTasks(participant, re, node);
Assert.assertNotNull(assignedTasks);
Assert.assertEquals(1, assignedTasks.size());
// create a revision date
gtaManager.createAndPersistTaskRevisionDate(assignedTasks.get(0), 2, TaskProcess.correction);
dbInstance.commitAndCloseSession();
// delete
int numOfDeletedObjects = gtaManager.deleteTaskList(re, node);
Assert.assertEquals(3, numOfDeletedObjects);
dbInstance.commitAndCloseSession();
// check that there isn't any tasks
List<Task> deletedAssignedTasks = gtaManager.getTasks(participant, re, node);
Assert.assertNotNull(deletedAssignedTasks);
Assert.assertEquals(0, deletedAssignedTasks.size());
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTAManagerTest method getTasks.
@Test
public void getTasks() {
Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-3");
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-4");
BusinessGroup businessGroup = businessGroupDao.createAndPersist(coach, "gdao", "gdao-desc", -1, -1, false, false, false, false, false);
businessGroupRelationDao.addRole(participant, businessGroup, GroupRole.participant.name());
dbInstance.commit();
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.group.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
File taskFile = new File("bg.txt");
Assert.assertNotNull(tasks);
dbInstance.commit();
// select
AssignmentResponse response = gtaManager.selectTask(businessGroup, tasks, node, taskFile);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(response);
List<Task> assignedTasks = gtaManager.getTasks(participant, re, node);
Assert.assertNotNull(assignedTasks);
Assert.assertEquals(1, assignedTasks.size());
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class GTANotifications method getItems.
public List<SubscriptionListItem> getItems() {
Publisher p = subscriber.getPublisher();
ICourse course = CourseFactory.loadCourse(p.getResId());
CourseNode node = course.getRunStructure().getNode(p.getSubidentifier());
RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
if (entry.getRepositoryEntryStatus().isClosed() || entry.getRepositoryEntryStatus().isUnpublished()) {
return Collections.emptyList();
}
if (entry != null && node instanceof GTACourseNode) {
gtaNode = (GTACourseNode) node;
displayName = entry.getDisplayname();
courseEnv = course.getCourseEnvironment();
taskList = gtaManager.getTaskList(entry, gtaNode);
if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
createBusinessGroupsSubscriptionInfo(subscriber.getIdentity());
} else {
createIndividualSubscriptionInfo(subscriber.getIdentity());
}
}
return items;
}
use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.
the class AbstractDueDateTaskRuleSPI method evaluate.
@Override
public List<Identity> evaluate(RepositoryEntry entry, ReminderRule rule) {
List<Identity> identities = null;
if (rule instanceof ReminderRuleImpl) {
ReminderRuleImpl r = (ReminderRuleImpl) rule;
String nodeIdent = r.getLeftOperand();
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
if (courseNode instanceof GTACourseNode) {
identities = evaluateRule(entry, (GTACourseNode) courseNode, r);
}
}
return identities == null ? Collections.<Identity>emptyList() : identities;
}
use of org.olat.course.nodes.GTACourseNode in project openolat by klemens.
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;
}
Aggregations