Search in sources :

Example 21 with TaskProcess

use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.

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 22 with TaskProcess

use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.

the class GTAManagerImpl method collectTask.

@Override
public Task collectTask(Task task, GTACourseNode cNode, int numOfDocs) {
    TaskProcess review = nextStep(TaskProcess.submit, cNode);
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setCollectionDate(new Date());
    taskImpl.setCollectionNumOfDocs(numOfDocs);
    return updateTask(task, review, cNode, Role.coach);
}
Also used : TaskProcess(org.olat.course.nodes.gta.TaskProcess) TaskImpl(org.olat.course.nodes.gta.model.TaskImpl) 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 23 with TaskProcess

use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.

the class GTAManagerImpl method submitTask.

@Override
public Task submitTask(Task task, GTACourseNode cNode, int numOfDocs, Role by) {
    TaskProcess review = nextStep(TaskProcess.submit, cNode);
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setSubmissionDate(new Date());
    taskImpl.setSubmissionNumOfDocs(numOfDocs);
    return updateTask(task, review, cNode, by);
}
Also used : TaskProcess(org.olat.course.nodes.gta.TaskProcess) TaskImpl(org.olat.course.nodes.gta.model.TaskImpl) 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 24 with TaskProcess

use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.

the class ConvertToGTACourseNode method setTaskStatus.

private void setTaskStatus(TaskList taskList, Identity assessedIdentity, TaskProcess current, GTACourseNode gtaNode) {
    TaskProcess process = gtaManager.nextStep(current, gtaNode);
    Task task = gtaManager.getTask(assessedIdentity, taskList);
    if (task == null) {
        gtaManager.createTask(null, taskList, process, null, assessedIdentity, gtaNode);
    } else {
        gtaManager.updateTask(task, process, gtaNode, Role.auto);
    }
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskProcess(org.olat.course.nodes.gta.TaskProcess)

Example 25 with TaskProcess

use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.

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)

Aggregations

TaskProcess (org.olat.course.nodes.gta.TaskProcess)40 Task (org.olat.course.nodes.gta.Task)16 TaskDueDate (org.olat.course.nodes.gta.TaskDueDate)14 Date (java.util.Date)12 TaskImpl (org.olat.course.nodes.gta.model.TaskImpl)12 TaskList (org.olat.course.nodes.gta.TaskList)10 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)10 DueDate (org.olat.course.nodes.gta.model.DueDate)10 ArrayList (java.util.ArrayList)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 RepositoryEntry (org.olat.repository.RepositoryEntry)6 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)4 File (java.io.File)2 ContextualSubscriptionController (org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController)2 Identity (org.olat.core.id.Identity)2 CoachedElementRow (org.olat.course.nodes.gta.ui.CoachedElementRow)2 BusinessGroup (org.olat.group.BusinessGroup)2 AssessmentEntryStatus (org.olat.modules.assessment.model.AssessmentEntryStatus)2