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;
}
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);
}
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;
}
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;
}
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);
}
Aggregations