Search in sources :

Example 16 with GTACourseNode

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());
}
Also used : Task(org.olat.course.nodes.gta.Task) BusinessGroup(org.olat.group.BusinessGroup) TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) File(java.io.File) Test(org.junit.Test)

Example 17 with GTACourseNode

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());
}
Also used : Task(org.olat.course.nodes.gta.Task) BusinessGroup(org.olat.group.BusinessGroup) TaskList(org.olat.course.nodes.gta.TaskList) GTACourseNode(org.olat.course.nodes.GTACourseNode) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) File(java.io.File) Test(org.junit.Test)

Example 18 with GTACourseNode

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;
}
Also used : GTACourseNode(org.olat.course.nodes.GTACourseNode) ICourse(org.olat.course.ICourse) Publisher(org.olat.core.commons.services.notifications.Publisher) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 19 with GTACourseNode

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;
}
Also used : ReminderRuleImpl(org.olat.modules.reminder.model.ReminderRuleImpl) GTACourseNode(org.olat.course.nodes.GTACourseNode) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) Identity(org.olat.core.id.Identity)

Example 20 with GTACourseNode

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

Aggregations

GTACourseNode (org.olat.course.nodes.GTACourseNode)74 RepositoryEntry (org.olat.repository.RepositoryEntry)52 Test (org.junit.Test)48 Identity (org.olat.core.id.Identity)48 TaskList (org.olat.course.nodes.gta.TaskList)48 File (java.io.File)36 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)28 Task (org.olat.course.nodes.gta.Task)24 BusinessGroup (org.olat.group.BusinessGroup)16 ArrayList (java.util.ArrayList)14 CourseNode (org.olat.course.nodes.CourseNode)14 List (java.util.List)12 ICourse (org.olat.course.ICourse)12 ReminderRuleImpl (org.olat.modules.reminder.model.ReminderRuleImpl)12 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 TACourseNode (org.olat.course.nodes.TACourseNode)8 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)8 Calendar (java.util.Calendar)6 Date (java.util.Date)6 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)6