use of org.olat.course.nodes.gta.model.TaskImpl in project openolat by klemens.
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 klemens.
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);
}
use of org.olat.course.nodes.gta.model.TaskImpl 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;
}
use of org.olat.course.nodes.gta.model.TaskImpl in project openolat by klemens.
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);
}
use of org.olat.course.nodes.gta.model.TaskImpl in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method reviewedTask.
@Override
public Task reviewedTask(Task task, GTACourseNode cNode) {
TaskProcess solution = nextStep(TaskProcess.correction, cNode);
TaskImpl taskImpl = (TaskImpl) task;
taskImpl.setAcceptationDate(new Date());
return updateTask(taskImpl, solution, cNode, Role.coach);
}
Aggregations