Search in sources :

Example 1 with TaskImpl

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

the class GTAManagerImpl method createTask.

@Override
public TaskImpl createTask(String taskName, TaskList taskList, TaskProcess status, BusinessGroup assessedGroup, Identity assessedIdentity, GTACourseNode cNode) {
    TaskImpl task = new TaskImpl();
    Date creationDate = new Date();
    task.setCreationDate(creationDate);
    task.setLastModified(creationDate);
    task.setTaskList(taskList);
    task.setTaskName(taskName);
    // assignment is ok -> go to submit step
    task.setTaskStatus(status);
    task.setRevisionLoop(0);
    if (status == TaskProcess.graded) {
        task.setGraduationDate(new Date());
    }
    if (GTAType.group.name().equals(cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        task.setBusinessGroup(assessedGroup);
    } else {
        task.setIdentity(assessedIdentity);
    }
    return task;
}
Also used : 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 2 with TaskImpl

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

the class GTAManagerImpl method submitRevisions.

@Override
public Task submitRevisions(Task task, GTACourseNode cNode, int numOfDocs, Role by) {
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setSubmissionRevisionsDate(new Date());
    taskImpl.setSubmissionRevisionsNumOfDocs(numOfDocs);
    // log the date
    createAndPersistTaskRevisionDate(taskImpl, taskImpl.getRevisionLoop(), TaskProcess.correction);
    return updateTask(taskImpl, TaskProcess.correction, cNode, by);
}
Also used : 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 3 with TaskImpl

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

the class GTAManagerImpl method nextStep.

@Override
public Task nextStep(Task task, GTACourseNode cNode, Role by) {
    TaskImpl taskImpl = (TaskImpl) task;
    TaskProcess currentStep = taskImpl.getTaskStatus();
    // cascade through the possible steps
    TaskProcess nextStep = nextStep(currentStep, cNode);
    taskImpl.setTaskStatus(nextStep);
    TaskImpl mergedTask = dbInstance.getCurrentEntityManager().merge(taskImpl);
    // make the thing definitiv
    dbInstance.commit();
    syncAssessmentEntry(mergedTask, cNode, by);
    return mergedTask;
}
Also used : TaskProcess(org.olat.course.nodes.gta.TaskProcess) TaskImpl(org.olat.course.nodes.gta.model.TaskImpl)

Example 4 with TaskImpl

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

the class GTAManagerImpl method resetTask.

@Override
public Task resetTask(Task task, GTACourseNode cNode, CourseEnvironment courseEnv) {
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setTaskName(null);
    taskImpl.setAllowResetDate(null);
    Task updatedTask = updateTask(task, TaskProcess.assignment, cNode, Role.user);
    File submissionDir = null;
    if (updatedTask.getBusinessGroup() != null) {
        submissionDir = getSubmitDirectory(courseEnv, cNode, updatedTask.getBusinessGroup());
    } else if (updatedTask.getIdentity() != null) {
        submissionDir = getSubmitDirectory(courseEnv, cNode, updatedTask.getIdentity());
    }
    if (submissionDir != null) {
        FileUtils.deleteDirsAndFiles(submissionDir, true, false);
    }
    return updatedTask;
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskImpl(org.olat.course.nodes.gta.model.TaskImpl) File(java.io.File)

Example 5 with TaskImpl

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

the class GTAManagerImpl method resetTaskRefused.

@Override
public Task resetTaskRefused(Task task, GTACourseNode cNode) {
    TaskImpl taskImpl = (TaskImpl) task;
    taskImpl.setAllowResetDate(null);
    taskImpl.setAllowResetIdentity(null);
    return updateTask(task, task.getTaskStatus(), cNode, Role.user);
}
Also used : TaskImpl(org.olat.course.nodes.gta.model.TaskImpl)

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