Search in sources :

Example 16 with TaskImpl

use of org.olat.course.nodes.gta.model.TaskImpl 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 17 with TaskImpl

use of org.olat.course.nodes.gta.model.TaskImpl 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 18 with TaskImpl

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

the class GTAManagerImpl method updateTask.

@Override
public Task updateTask(Task task, TaskProcess newStatus, GTACourseNode cNode, Role by) {
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setTaskStatus(newStatus);
    syncDates(taskImpl, newStatus);
    taskImpl = dbInstance.getCurrentEntityManager().merge(taskImpl);
    syncAssessmentEntry(taskImpl, cNode, by);
    // update
    OLATResource resource = taskImpl.getTaskList().getEntry().getOlatResource();
    notificationsManager.markPublisherNews(getSubscriptionContext(resource, cNode), null, false);
    return taskImpl;
}
Also used : TaskImpl(org.olat.course.nodes.gta.model.TaskImpl) OLATResource(org.olat.resource.OLATResource)

Example 19 with TaskImpl

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

the class GTAManagerImpl method updateTask.

@Override
public Task updateTask(Task task, TaskProcess newStatus, int iteration, GTACourseNode cNode, Role by) {
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setTaskStatus(newStatus);
    taskImpl.setRevisionLoop(iteration);
    taskImpl = dbInstance.getCurrentEntityManager().merge(taskImpl);
    // log date
    createAndPersistTaskRevisionDate(taskImpl, iteration, newStatus);
    syncAssessmentEntry(taskImpl, cNode, by);
    return taskImpl;
}
Also used : TaskImpl(org.olat.course.nodes.gta.model.TaskImpl)

Example 20 with TaskImpl

use of org.olat.course.nodes.gta.model.TaskImpl 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)

Aggregations

TaskImpl (org.olat.course.nodes.gta.model.TaskImpl)26 Date (java.util.Date)16 TaskDueDate (org.olat.course.nodes.gta.TaskDueDate)16 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)16 DueDate (org.olat.course.nodes.gta.model.DueDate)16 TaskProcess (org.olat.course.nodes.gta.TaskProcess)12 Task (org.olat.course.nodes.gta.Task)6 File (java.io.File)4 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)4 TaskList (org.olat.course.nodes.gta.TaskList)4 OLATResource (org.olat.resource.OLATResource)2