use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.
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);
}
}
use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.
the class GTAAbstractController method process.
protected final void process(UserRequest ureq) {
Task task;
if (businessGroupTask) {
task = gtaManager.getTask(assessedGroup, taskList);
} else {
task = gtaManager.getTask(assessedIdentity, taskList);
}
if (withSubscription && subsContext != null) {
contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, publisherData);
listenTo(contextualSubscriptionCtr);
mainVC.put("contextualSubscription", contextualSubscriptionCtr.getInitialComponent());
}
boolean assignment = config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT);
mainVC.contextPut("assignmentEnabled", assignment);
if (assignment) {
task = stepAssignment(ureq, task);
} else if (task == null) {
TaskProcess firstStep = gtaManager.firstStep(gtaNode);
task = gtaManager.createTask(null, taskList, firstStep, assessedGroup, assessedIdentity, gtaNode);
}
boolean submit = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
mainVC.contextPut("submitEnabled", submit);
if (submit) {
task = stepSubmit(ureq, task);
} else if (task != null && task.getTaskStatus() == TaskProcess.submit) {
task = gtaManager.nextStep(task, gtaNode, Role.auto);
}
boolean reviewAndCorrection = config.getBooleanSafe(GTACourseNode.GTASK_REVIEW_AND_CORRECTION);
mainVC.contextPut("reviewAndCorrectionEnabled", reviewAndCorrection);
if (reviewAndCorrection) {
task = stepReviewAndCorrection(ureq, task);
} else if (task != null && task.getTaskStatus() == TaskProcess.review) {
task = gtaManager.nextStep(task, gtaNode, Role.auto);
}
boolean revision = config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD);
mainVC.contextPut("revisionEnabled", reviewAndCorrection && revision);
if (reviewAndCorrection && revision) {
task = stepRevision(ureq, task);
} else if (task != null && (task.getTaskStatus() == TaskProcess.revision || task.getTaskStatus() == TaskProcess.correction)) {
task = gtaManager.nextStep(task, gtaNode, Role.auto);
}
boolean solution = config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION);
mainVC.contextPut("solutionEnabled", solution);
if (solution) {
stepSolution(ureq, task);
} else if (task != null && task.getTaskStatus() == TaskProcess.solution) {
task = gtaManager.nextStep(task, gtaNode, Role.auto);
}
boolean grading = config.getBooleanSafe(GTACourseNode.GTASK_GRADING);
mainVC.contextPut("gradingEnabled", grading);
if (grading) {
stepGrading(ureq, task);
} else if (task != null && task.getTaskStatus() == TaskProcess.grading) {
task = gtaManager.nextStep(task, gtaNode, Role.auto);
}
mainVC.contextPut("changelogconfig", courseModule.isDisplayChangeLog());
resetTask(ureq, task);
nodeLog();
collapsedContents(task);
}
use of org.olat.course.nodes.gta.TaskProcess 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;
}
use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.
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;
}
use of org.olat.course.nodes.gta.TaskProcess in project OpenOLAT by OpenOLAT.
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);
}
Aggregations