Search in sources :

Example 6 with TaskProcess

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

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

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

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

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

the class GTAManagerImpl method assignTaskAutomatically.

private AssignmentResponse assignTaskAutomatically(TaskList tasks, BusinessGroup businessGroup, Identity identity, CourseEnvironment courseEnv, GTACourseNode cNode) {
    Task currentTask;
    if (businessGroup != null) {
        currentTask = getTask(businessGroup, tasks);
    } else {
        currentTask = getTask(identity, tasks);
    }
    AssignmentResponse response;
    if (currentTask == null) {
        TaskList reloadedTasks = loadForUpdate(tasks);
        File tasksFolder = getTasksDirectory(courseEnv, cNode);
        String[] taskFiles = tasksFolder.list(SystemFilenameFilter.FILES_ONLY);
        List<String> assignedFilenames = getAssignedTasks(reloadedTasks);
        String taskName;
        if (GTACourseNode.GTASK_SAMPLING_UNIQUE.equals(cNode.getModuleConfiguration().get(GTACourseNode.GTASK_SAMPLING))) {
            taskName = nextUnique(taskFiles, assignedFilenames);
        } else {
            taskName = nextSlotRoundRobin(taskFiles, assignedFilenames);
        }
        if (taskName == null) {
            response = AssignmentResponse.NO_MORE_TASKS;
        } else {
            TaskProcess nextStep = nextStep(TaskProcess.assignment, cNode);
            TaskImpl task = createTask(taskName, reloadedTasks, nextStep, businessGroup, identity, cNode);
            task.setAssignmentDate(new Date());
            dbInstance.getCurrentEntityManager().persist(task);
            dbInstance.commit();
            syncAssessmentEntry((TaskImpl) currentTask, cNode, Role.user);
            response = new AssignmentResponse(task, Status.ok);
        }
    } else {
        if (currentTask.getTaskStatus() == TaskProcess.assignment) {
            ((TaskImpl) currentTask).setTaskStatus(TaskProcess.submit);
        }
        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) File(java.io.File) 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 9 with TaskProcess

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

the class GTACoachRevisionAndCorrectionsController method initRevisionProcess.

private void initRevisionProcess(UserRequest ureq) {
    List<String> revisionStepNames = new ArrayList<>();
    mainVC.contextPut("previousRevisions", revisionStepNames);
    if (collectButton != null) {
        // reset collect
        mainVC.remove(collectButton);
    }
    if (assignedTask.getRevisionLoop() > 1) {
        for (int i = 1; i < assignedTask.getRevisionLoop(); i++) {
            setRevisionIteration(ureq, i, revisionStepNames);
        }
    }
    TaskProcess status = assignedTask.getTaskStatus();
    if (status == TaskProcess.revision) {
        // assessed user can return some revised documents
        setRevisions(ureq, "revisions", currentIteration);
        setCollectRevisions();
    } else if (status == TaskProcess.correction) {
        // coach can return some corrections
        setRevisions(ureq, "revisions", currentIteration);
        setUploadCorrections(ureq, assignedTask, assignedTask.getRevisionLoop());
    } else {
        int lastIteration = assignedTask.getRevisionLoop();
        setRevisionIteration(ureq, lastIteration, revisionStepNames);
    }
}
Also used : TaskProcess(org.olat.course.nodes.gta.TaskProcess) ArrayList(java.util.ArrayList)

Example 10 with TaskProcess

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

the class EditMultipleDueDatesController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    for (Task task : tasks) {
        TaskDueDate dueDates = gtaManager.getDueDatesTask(task);
        dueDates.setAssignmentDueDate(assignmentDueDateEl.getDate());
        dueDates.setSubmissionDueDate(submissionDueDateEl.getDate());
        dueDates.setRevisionsDueDate(revisionDueDateEl.getDate());
        dueDates.setSolutionDueDate(solutionDueDateEl.getDate());
        dueDates = gtaManager.updateTaskDueDate(dueDates);
        if (task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal() && dueDates.getSubmissionDueDate() != null && dueDates.getSubmissionDueDate().after(ureq.getRequestTimestamp())) {
            // only submit allowed
            TaskProcess submit = gtaManager.previousStep(TaskProcess.review, gtaNode);
            if (submit == TaskProcess.submit) {
                task = gtaManager.updateTask(task, submit, gtaNode, Role.coach);
                gtaManager.log("Back to submission", "revert status of task back to submission", task, getIdentity(), task.getIdentity(), task.getBusinessGroup(), courseEnv, gtaNode);
            }
        }
    }
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : Task(org.olat.course.nodes.gta.Task) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) TaskProcess(org.olat.course.nodes.gta.TaskProcess)

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