Search in sources :

Example 96 with TaskList

use of org.olat.course.nodes.gta.TaskList in project openolat by klemens.

the class GTACoachedGroupListController method doEditDueDate.

private void doEditDueDate(UserRequest ureq, CoachedGroupRow row) {
    if (editDueDatesCtrl != null)
        return;
    Task task;
    BusinessGroup assessedGroup = row.getBusinessGroup();
    RepositoryEntry entry = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    if (row.getTask() == null) {
        TaskProcess firstStep = gtaManager.firstStep(gtaNode);
        TaskList taskList = gtaManager.getTaskList(entry, gtaNode);
        task = gtaManager.createAndPersistTask(null, taskList, firstStep, assessedGroup, null, gtaNode);
    } else {
        task = gtaManager.getTask(row.getTask());
    }
    editDueDatesCtrl = new EditDueDatesController(ureq, getWindowControl(), task, null, assessedGroup, gtaNode, entry, courseEnv);
    listenTo(editDueDatesCtrl);
    String title = translate("duedates.user", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) });
    cmc = new CloseableModalController(getWindowControl(), "close", editDueDatesCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : Task(org.olat.course.nodes.gta.Task) BusinessGroup(org.olat.group.BusinessGroup) TaskProcess(org.olat.course.nodes.gta.TaskProcess) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TaskList(org.olat.course.nodes.gta.TaskList) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 97 with TaskList

use of org.olat.course.nodes.gta.TaskList in project openolat by klemens.

the class GTACoachedParticipantListController method doEditDueDate.

private void doEditDueDate(UserRequest ureq, CoachedIdentityRow row) {
    if (editDueDatesCtrl != null)
        return;
    Task task;
    Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentity().getIdentityKey());
    RepositoryEntry entry = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    if (row.getTask() == null) {
        TaskProcess firstStep = gtaManager.firstStep(gtaNode);
        TaskList taskList = gtaManager.getTaskList(entry, gtaNode);
        task = gtaManager.createAndPersistTask(null, taskList, firstStep, null, assessedIdentity, gtaNode);
    } else {
        task = gtaManager.getTask(row.getTask());
    }
    editDueDatesCtrl = new EditDueDatesController(ureq, getWindowControl(), task, assessedIdentity, null, gtaNode, entry, courseEnv);
    listenTo(editDueDatesCtrl);
    String fullname = userManager.getUserDisplayName(assessedIdentity);
    String title = translate("duedates.user", new String[] { fullname });
    cmc = new CloseableModalController(getWindowControl(), "close", editDueDatesCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskProcess(org.olat.course.nodes.gta.TaskProcess) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TaskList(org.olat.course.nodes.gta.TaskList) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity)

Example 98 with TaskList

use of org.olat.course.nodes.gta.TaskList in project openolat by klemens.

the class GTAManagerImpl method selectTask.

private AssignmentResponse selectTask(Identity identity, BusinessGroup businessGroup, TaskList tasks, GTACourseNode cNode, File taskFile) {
    Task currentTask;
    if (businessGroup != null) {
        currentTask = getTask(businessGroup, tasks);
    } else {
        currentTask = getTask(identity, tasks);
    }
    AssignmentResponse response;
    if (currentTask == null) {
        String taskName = taskFile.getName();
        TaskList reloadedTasks = loadForUpdate(tasks);
        String sampling = cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_SAMPLING);
        if (GTACourseNode.GTASK_SAMPLING_UNIQUE.equals(sampling) && isTaskAssigned(reloadedTasks, taskName)) {
            response = new AssignmentResponse(null, Status.alreadyAssigned);
        } else {
            TaskProcess nextStep = nextStep(TaskProcess.assignment, cNode);
            TaskImpl task = createTask(taskName, reloadedTasks, nextStep, businessGroup, identity, cNode);
            task.setAssignmentDate(new Date());
            dbInstance.getCurrentEntityManager().persist(task);
            syncAssessmentEntry(task, cNode, Role.user);
            response = new AssignmentResponse(task, Status.ok);
        }
        dbInstance.commit();
    } else {
        if (currentTask.getTaskStatus() == TaskProcess.assignment) {
            TaskProcess nextStep = nextStep(currentTask.getTaskStatus(), cNode);
            ((TaskImpl) currentTask).setTaskStatus(nextStep);
            if (taskFile != null) {
                ((TaskImpl) currentTask).setTaskName(taskFile.getName());
            }
        }
        currentTask = dbInstance.getCurrentEntityManager().merge(currentTask);
        syncAssessmentEntry((TaskImpl) currentTask, cNode, Role.user);
        response = new AssignmentResponse(currentTask, Status.ok);
    }
    return response;
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskProcess(org.olat.course.nodes.gta.TaskProcess) TaskImpl(org.olat.course.nodes.gta.model.TaskImpl) TaskList(org.olat.course.nodes.gta.TaskList) AssignmentResponse(org.olat.course.nodes.gta.AssignmentResponse) Date(java.util.Date) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 99 with TaskList

use of org.olat.course.nodes.gta.TaskList in project openolat by klemens.

the class GTAManagerImpl method deleteTaskList.

@Override
public int deleteTaskList(RepositoryEntryRef entry, GTACourseNode cNode) {
    TaskList taskList = getTaskList(entry, cNode);
    int numOfDeletedObjects = 0;
    if (taskList != null) {
        StringBuilder sb = new StringBuilder(128);
        sb.append("delete from gtataskrevisiondate as taskrev where taskrev.task.key in (").append("  select task.key from gtatask as task where task.taskList.key=:taskListKey)");
        numOfDeletedObjects += dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("taskListKey", taskList.getKey()).executeUpdate();
        String deleteTasks = "delete from gtatask as task where task.taskList.key=:taskListKey";
        numOfDeletedObjects += dbInstance.getCurrentEntityManager().createQuery(deleteTasks).setParameter("taskListKey", taskList.getKey()).executeUpdate();
        numOfDeletedObjects += gtaMarkDao.deleteMark(taskList);
        dbInstance.getCurrentEntityManager().remove(taskList);
        numOfDeletedObjects++;
    }
    return numOfDeletedObjects;
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList)

Example 100 with TaskList

use of org.olat.course.nodes.gta.TaskList in project openolat by klemens.

the class GTAManagerImpl method createIfNotExists.

@Override
public TaskList createIfNotExists(RepositoryEntry entry, GTACourseNode cNode) {
    TaskList tasks = getTaskList(entry, cNode);
    if (tasks == null) {
        TaskListImpl tasksImpl = new TaskListImpl();
        Date creationDate = new Date();
        tasksImpl.setCreationDate(creationDate);
        tasksImpl.setLastModified(creationDate);
        tasksImpl.setEntry(entry);
        tasksImpl.setCourseNodeIdent(cNode.getIdent());
        dbInstance.getCurrentEntityManager().persist(tasksImpl);
        tasks = tasksImpl;
    }
    return tasks;
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) TaskListImpl(org.olat.course.nodes.gta.model.TaskListImpl) Date(java.util.Date) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Aggregations

TaskList (org.olat.course.nodes.gta.TaskList)102 Identity (org.olat.core.id.Identity)68 Test (org.junit.Test)64 RepositoryEntry (org.olat.repository.RepositoryEntry)60 GTACourseNode (org.olat.course.nodes.GTACourseNode)48 File (java.io.File)36 Task (org.olat.course.nodes.gta.Task)36 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)32 BusinessGroup (org.olat.group.BusinessGroup)20 ArrayList (java.util.ArrayList)16 Date (java.util.Date)12 List (java.util.List)12 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)12 TaskProcess (org.olat.course.nodes.gta.TaskProcess)10 ReminderRuleImpl (org.olat.modules.reminder.model.ReminderRuleImpl)10 IdentityMark (org.olat.course.nodes.gta.IdentityMark)8 ModuleConfiguration (org.olat.modules.ModuleConfiguration)8 Calendar (java.util.Calendar)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 GTAManager (org.olat.course.nodes.gta.GTAManager)6